<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>sgp4oo: Fichero Fuente sgp4unit.cpp</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generado por Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Página&nbsp;principal</span></a></li>
      <li><a href="annotated.html"><span>Clases</span></a></li>
      <li class="current"><a href="files.html"><span>Archivos</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>Lista&nbsp;de&nbsp;archivos</span></a></li>
      <li><a href="globals.html"><span>Miembros&nbsp;de&nbsp;los&nbsp;ficheros</span></a></li>
    </ul>
  </div>
<h1>sgp4unit.cpp</h1><a href="sgp4unit_8cpp.html">Ir a la documentación de este archivo.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Sgp4unit.cpp</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> *  Created on: 25/04/2012</span>
<a name="l00005"></a>00005 <span class="comment"> *      Author: ubuntu</span>
<a name="l00006"></a>00006 <span class="comment"> */</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="preprocessor">#include &quot;<a class="code" href="sgp4unit_8h.html">sgp4unit.h</a>&quot;</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &quot;<a class="code" href="sgp4__math_8h.html">sgp4_math.h</a>&quot;</span>
<a name="l00010"></a>00010 <span class="preprocessor">#include &quot;<a class="code" href="sgp4__date_8h.html">sgp4_date.h</a>&quot;</span>
<a name="l00011"></a>00011 
<a name="l00012"></a>00012 
<a name="l00016"></a><a class="code" href="class_sgp4unit.html#a1931b20197903e79ce10c4961724563b">00016</a> <a class="code" href="class_sgp4unit.html#a1931b20197903e79ce10c4961724563b" title="Construye un nuevo objeto Sgp4unit.">Sgp4unit::Sgp4unit</a>() {
<a name="l00017"></a>00017         this-&gt;satrec = <span class="keyword">new</span> <a class="code" href="classelsetrec.html#a49c472c74ffed332c579fff6c7a98896">elsetrec::elsetrec</a>();
<a name="l00018"></a>00018 }
<a name="l00019"></a>00019 
<a name="l00024"></a><a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a">00024</a> <a class="code" href="classelsetrec.html">elsetrec</a>* <a class="code" href="class_sgp4unit.html#a3c168167d71c870963aacb6819b2a15a" title="Devuelve el objeto elsetrec que contiene sgp4unit.">Sgp4unit::getSatrec</a>(){
<a name="l00025"></a>00025         <span class="keywordflow">return</span> satrec;
<a name="l00026"></a>00026 }
<a name="l00027"></a>00027 
<a name="l00070"></a>00070 <span class="keywordtype">void</span> Sgp4unit::dsinit
<a name="l00071"></a>00071      (
<a name="l00072"></a>00072        <a class="code" href="gravconsttype_8h.html#a8b910c09824c4a9d8365e717c31dda5e">gravconsttype</a> whichconst,
<a name="l00073"></a>00073        <span class="keywordtype">double</span> cosim,  <span class="keywordtype">double</span> emsq,   <span class="keywordtype">double</span> s1,     <span class="keywordtype">double</span> s2,
<a name="l00074"></a>00074        <span class="keywordtype">double</span> s3,     <span class="keywordtype">double</span> s4,     <span class="keywordtype">double</span> s5,      <span class="keywordtype">double</span> sinim,  <span class="keywordtype">double</span> ss1,
<a name="l00075"></a>00075        <span class="keywordtype">double</span> ss2,    <span class="keywordtype">double</span> ss3,    <span class="keywordtype">double</span> ss4,     <span class="keywordtype">double</span> ss5,    <span class="keywordtype">double</span> sz1,
<a name="l00076"></a>00076        <span class="keywordtype">double</span> sz3,    <span class="keywordtype">double</span> sz11,   <span class="keywordtype">double</span> sz13,    <span class="keywordtype">double</span> sz21,   <span class="keywordtype">double</span> sz23,
<a name="l00077"></a>00077        <span class="keywordtype">double</span> sz31,   <span class="keywordtype">double</span> sz33,   <span class="keywordtype">double</span> tc,      <span class="keywordtype">double</span> xpidot, <span class="keywordtype">double</span> z1,
<a name="l00078"></a>00078        <span class="keywordtype">double</span> z3,      <span class="keywordtype">double</span> z11,    <span class="keywordtype">double</span> z13,
<a name="l00079"></a>00079        <span class="keywordtype">double</span> z21,    <span class="keywordtype">double</span> z23,    <span class="keywordtype">double</span> z31,     <span class="keywordtype">double</span> z33,    <span class="keywordtype">double</span> eccsq,
<a name="l00080"></a>00080        <span class="keywordtype">double</span>&amp; em,    <span class="keywordtype">double</span>&amp; argpm,  <span class="keywordtype">double</span>&amp; inclm, <span class="keywordtype">double</span>&amp; mm,
<a name="l00081"></a>00081        <span class="keywordtype">double</span>&amp; nm,    <span class="keywordtype">double</span>&amp; nodem, <span class="keywordtype">double</span>&amp; dndt
<a name="l00082"></a>00082      )
<a name="l00083"></a>00083 {
<a name="l00084"></a>00084 
<a name="l00085"></a>00085      <span class="comment">/* --------------------- local variables ------------------------ */</span>
<a name="l00086"></a>00086      <span class="keyword">const</span> <span class="keywordtype">double</span> twopi = 2.0 * <a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>;
<a name="l00087"></a>00087 
<a name="l00088"></a>00088      <span class="keywordtype">double</span> ainv2 , aonv=0.0, cosisq, eoc, f220 , f221  , f311  ,
<a name="l00089"></a>00089           f321  , f322  , f330  , f441  , f442  , f522  , f523  ,
<a name="l00090"></a>00090           f542  , f543  , g200  , g201  , g211  , g300  , g310  ,
<a name="l00091"></a>00091           g322  , g410  , g422  , g520  , g521  , g532  , g533  ,
<a name="l00092"></a>00092           ses   , sgs   , sghl  , sghs  , shs   , shll  , sis   ,
<a name="l00093"></a>00093           sini2 , sls   , temp  , temp1 , theta , xno2  , q22   ,
<a name="l00094"></a>00094           q31   , q33   , root22, root44, root54, rptim , root32,
<a name="l00095"></a>00095           root52, x2o3  , xke   , znl   , emo   , zns   , emsqo,
<a name="l00096"></a>00096           tumin, mu, radiusearthkm, j2, j3, j4, j3oj2;
<a name="l00097"></a>00097 
<a name="l00098"></a>00098      q22    = 1.7891679e-6;
<a name="l00099"></a>00099      q31    = 2.1460748e-6;
<a name="l00100"></a>00100      q33    = 2.2123015e-7;
<a name="l00101"></a>00101      root22 = 1.7891679e-6;
<a name="l00102"></a>00102      root44 = 7.3636953e-9;
<a name="l00103"></a>00103      root54 = 2.1765803e-9;
<a name="l00104"></a>00104      rptim  = 4.37526908801129966e-3; <span class="comment">// this equates to 7.29211514668855e-5 rad/sec</span>
<a name="l00105"></a>00105      root32 = 3.7393792e-7;
<a name="l00106"></a>00106      root52 = 1.1428639e-7;
<a name="l00107"></a>00107      x2o3   = 2.0 / 3.0;
<a name="l00108"></a>00108      znl    = 1.5835218e-4;
<a name="l00109"></a>00109      zns    = 1.19459e-5;
<a name="l00110"></a>00110 
<a name="l00111"></a>00111      <span class="comment">// sgp4fix identify constants and allow alternate values</span>
<a name="l00112"></a>00112      <a class="code" href="gravconsttype_8cpp.html#ad4600d22fe78cc71f195a7c50ed92f3b" title="Esta función se utiliza para obtener el conjunto de valores dependiendo de la constante...">getgravconst</a>( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
<a name="l00113"></a>00113 
<a name="l00114"></a>00114      <span class="comment">/* -------------------- deep space initialization ------------ */</span>
<a name="l00115"></a>00115      satrec-&gt;<a class="code" href="classelsetrec.html#a7ad09474d5a7f306cca572593a707396">setIrez</a>(0);
<a name="l00116"></a>00116      <span class="keywordflow">if</span> ((nm &lt; 0.0052359877) &amp;&amp; (nm &gt; 0.0034906585))
<a name="l00117"></a>00117          satrec-&gt;<a class="code" href="classelsetrec.html#a7ad09474d5a7f306cca572593a707396">setIrez</a>(1);
<a name="l00118"></a>00118      <span class="keywordflow">if</span> ((nm &gt;= 8.26e-3) &amp;&amp; (nm &lt;= 9.24e-3) &amp;&amp; (em &gt;= 0.5))
<a name="l00119"></a>00119          satrec-&gt;<a class="code" href="classelsetrec.html#a7ad09474d5a7f306cca572593a707396">setIrez</a>(2);
<a name="l00120"></a>00120 
<a name="l00121"></a>00121      <span class="comment">/* ------------------------ do solar terms ------------------- */</span>
<a name="l00122"></a>00122      ses  =  ss1 * zns * ss5;
<a name="l00123"></a>00123      sis  =  ss2 * zns * (sz11 + sz13);
<a name="l00124"></a>00124      sls  = -zns * ss3 * (sz1 + sz3 - 14.0 - 6.0 * emsq);
<a name="l00125"></a>00125      sghs =  ss4 * zns * (sz31 + sz33 - 6.0);
<a name="l00126"></a>00126      shs  = -zns * ss2 * (sz21 + sz23);
<a name="l00127"></a>00127      <span class="comment">// sgp4fix for 180 deg incl</span>
<a name="l00128"></a>00128      <span class="keywordflow">if</span> ((inclm &lt; 5.2359877e-2) || (inclm &gt; <a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a> - 5.2359877e-2))
<a name="l00129"></a>00129        shs = 0.0;
<a name="l00130"></a>00130      <span class="keywordflow">if</span> (sinim != 0.0)
<a name="l00131"></a>00131        shs = shs / sinim;
<a name="l00132"></a>00132      sgs  = sghs - cosim * shs;
<a name="l00133"></a>00133 
<a name="l00134"></a>00134      <span class="comment">/* ------------------------- do lunar terms ------------------ */</span>
<a name="l00135"></a>00135      satrec-&gt;<a class="code" href="classelsetrec.html#acea19cbf887adb2d2399cc2cefd996f0">setDedt</a>(ses + s1 * znl * s5);
<a name="l00136"></a>00136      satrec-&gt;<a class="code" href="classelsetrec.html#acebcecf27e3e05a24c9a0f62943ed535">setDidt</a>(sis + s2 * znl * (z11 + z13));
<a name="l00137"></a>00137      satrec-&gt;<a class="code" href="classelsetrec.html#a80feceea915c4d873aa513a70c55ec7c">setDmdt</a>(sls - znl * s3 * (z1 + z3 - 14.0 - 6.0 * emsq));
<a name="l00138"></a>00138      sghl = s4 * znl * (z31 + z33 - 6.0);
<a name="l00139"></a>00139      shll = -znl * s2 * (z21 + z23);
<a name="l00140"></a>00140      <span class="comment">// sgp4fix for 180 deg incl</span>
<a name="l00141"></a>00141      <span class="keywordflow">if</span> ((inclm &lt; 5.2359877e-2) || (inclm &gt; <a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a> - 5.2359877e-2))
<a name="l00142"></a>00142          shll = 0.0;
<a name="l00143"></a>00143      satrec-&gt;<a class="code" href="classelsetrec.html#a10d3727699b07bbf3fd67d46ef59504c">setDomdt</a>(sgs + sghl);
<a name="l00144"></a>00144      satrec-&gt;<a class="code" href="classelsetrec.html#a5ff618c475ae19d0ce13aae7dc1110ea">setDnodt</a>(shs);
<a name="l00145"></a>00145      <span class="keywordflow">if</span> (sinim != 0.0)
<a name="l00146"></a>00146        {
<a name="l00147"></a>00147          satrec-&gt;<a class="code" href="classelsetrec.html#a10d3727699b07bbf3fd67d46ef59504c">setDomdt</a>(satrec-&gt;<a class="code" href="classelsetrec.html#ab4315aae38fd2eea08f3e884e7c0b55b">getDomdt</a>() - cosim / sinim * shll);
<a name="l00148"></a>00148          satrec-&gt;<a class="code" href="classelsetrec.html#a5ff618c475ae19d0ce13aae7dc1110ea">setDnodt</a>(satrec-&gt;<a class="code" href="classelsetrec.html#ab4315aae38fd2eea08f3e884e7c0b55b">getDomdt</a>() + shll / sinim);
<a name="l00149"></a>00149        }
<a name="l00150"></a>00150 
<a name="l00151"></a>00151      <span class="comment">/* ----------- calculate deep space resonance effects -------- */</span>
<a name="l00152"></a>00152      dndt   = 0.0;
<a name="l00153"></a>00153      theta  = fmod(satrec-&gt;<a class="code" href="classelsetrec.html#aee34e33b848b20c139348575e3da4b87">getGsto</a>() + tc * rptim, twopi);
<a name="l00154"></a>00154      em     = em + satrec-&gt;<a class="code" href="classelsetrec.html#a202696deeec511534c7ebe7fd8509fb2">getDedt</a>() * satrec-&gt;<a class="code" href="classelsetrec.html#a350c57362f816a4668ddbeecf0fb50e5">getT</a>();
<a name="l00155"></a>00155      inclm  = inclm + satrec-&gt;<a class="code" href="classelsetrec.html#ad2be35db316c3cda1ee3426400c67807">getDidt</a>() * satrec-&gt;<a class="code" href="classelsetrec.html#a350c57362f816a4668ddbeecf0fb50e5">getT</a>();
<a name="l00156"></a>00156      argpm  = argpm + satrec-&gt;<a class="code" href="classelsetrec.html#ab4315aae38fd2eea08f3e884e7c0b55b">getDomdt</a>() * satrec-&gt;<a class="code" href="classelsetrec.html#a350c57362f816a4668ddbeecf0fb50e5">getT</a>();
<a name="l00157"></a>00157      nodem  = nodem + satrec-&gt;<a class="code" href="classelsetrec.html#a35ef1187bf8b78a21080b328663a50c1">getDnodt</a>() * satrec-&gt;<a class="code" href="classelsetrec.html#a350c57362f816a4668ddbeecf0fb50e5">getT</a>();
<a name="l00158"></a>00158      mm     = mm + satrec-&gt;<a class="code" href="classelsetrec.html#aca1dc0706d64d34ee482c2ac38aaf4f6">getDmdt</a>() * satrec-&gt;<a class="code" href="classelsetrec.html#a350c57362f816a4668ddbeecf0fb50e5">getT</a>();
<a name="l00159"></a>00159      <span class="comment">//   sgp4fix for negative inclinations</span>
<a name="l00160"></a>00160      <span class="comment">//   the following if statement should be commented out</span>
<a name="l00161"></a>00161      <span class="comment">//if (inclm &lt; 0.0)</span>
<a name="l00162"></a>00162      <span class="comment">//  {</span>
<a name="l00163"></a>00163      <span class="comment">//    inclm  = -inclm;</span>
<a name="l00164"></a>00164      <span class="comment">//    argpm  = argpm - pi;</span>
<a name="l00165"></a>00165      <span class="comment">//    nodem = nodem + pi;</span>
<a name="l00166"></a>00166      <span class="comment">//  }</span>
<a name="l00167"></a>00167 
<a name="l00168"></a>00168      <span class="comment">/* -------------- initialize the resonance terms ------------- */</span>
<a name="l00169"></a>00169      <span class="keywordflow">if</span> (satrec-&gt;<a class="code" href="classelsetrec.html#ab6fb613a8a25fdc3e22777c9ce68c320">getIrez</a>() != 0)
<a name="l00170"></a>00170        {
<a name="l00171"></a>00171          aonv = pow(nm / xke, x2o3);
<a name="l00172"></a>00172 
<a name="l00173"></a>00173          <span class="comment">/* ---------- geopotential resonance for 12 hour orbits ------ */</span>
<a name="l00174"></a>00174          <span class="keywordflow">if</span> (satrec-&gt;<a class="code" href="classelsetrec.html#ab6fb613a8a25fdc3e22777c9ce68c320">getIrez</a>() == 2)
<a name="l00175"></a>00175            {
<a name="l00176"></a>00176              cosisq = cosim * cosim;
<a name="l00177"></a>00177              emo    = em;
<a name="l00178"></a>00178              em     = satrec-&gt;<a class="code" href="classelsetrec.html#a6ae438d068b3152b1a706b246995092e">getEcco</a>();
<a name="l00179"></a>00179              emsqo  = emsq;
<a name="l00180"></a>00180              emsq   = eccsq;
<a name="l00181"></a>00181              eoc    = em * emsq;
<a name="l00182"></a>00182              g201   = -0.306 - (em - 0.64) * 0.440;
<a name="l00183"></a>00183 
<a name="l00184"></a>00184              <span class="keywordflow">if</span> (em &lt;= 0.65)
<a name="l00185"></a>00185                {
<a name="l00186"></a>00186                  g211 =    3.616  -  13.2470 * em +  16.2900 * emsq;
<a name="l00187"></a>00187                  g310 =  -19.302  + 117.3900 * em - 228.4190 * emsq +  156.5910 * eoc;
<a name="l00188"></a>00188                  g322 =  -18.9068 + 109.7927 * em - 214.6334 * emsq +  146.5816 * eoc;
<a name="l00189"></a>00189                  g410 =  -41.122  + 242.6940 * em - 471.0940 * emsq +  313.9530 * eoc;
<a name="l00190"></a>00190                  g422 = -146.407  + 841.8800 * em - 1629.014 * emsq + 1083.4350 * eoc;
<a name="l00191"></a>00191                  g520 = -532.114  + 3017.977 * em - 5740.032 * emsq + 3708.2760 * eoc;
<a name="l00192"></a>00192                }
<a name="l00193"></a>00193                <span class="keywordflow">else</span>
<a name="l00194"></a>00194                {
<a name="l00195"></a>00195                  g211 =   -72.099 +   331.819 * em -   508.738 * emsq +   266.724 * eoc;
<a name="l00196"></a>00196                  g310 =  -346.844 +  1582.851 * em -  2415.925 * emsq +  1246.113 * eoc;
<a name="l00197"></a>00197                  g322 =  -342.585 +  1554.908 * em -  2366.899 * emsq +  1215.972 * eoc;
<a name="l00198"></a>00198                  g410 = -1052.797 +  4758.686 * em -  7193.992 * emsq +  3651.957 * eoc;
<a name="l00199"></a>00199                  g422 = -3581.690 + 16178.110 * em - 24462.770 * emsq + 12422.520 * eoc;
<a name="l00200"></a>00200                  <span class="keywordflow">if</span> (em &gt; 0.715)
<a name="l00201"></a>00201                      g520 =-5149.66 + 29936.92 * em - 54087.36 * emsq + 31324.56 * eoc;
<a name="l00202"></a>00202                    <span class="keywordflow">else</span>
<a name="l00203"></a>00203                      g520 = 1464.74 -  4664.75 * em +  3763.64 * emsq;
<a name="l00204"></a>00204                }
<a name="l00205"></a>00205              <span class="keywordflow">if</span> (em &lt; 0.7)
<a name="l00206"></a>00206                {
<a name="l00207"></a>00207                  g533 = -919.22770 + 4988.6100 * em - 9064.7700 * emsq + 5542.21  * eoc;
<a name="l00208"></a>00208                  g521 = -822.71072 + 4568.6173 * em - 8491.4146 * emsq + 5337.524 * eoc;
<a name="l00209"></a>00209                  g532 = -853.66600 + 4690.2500 * em - 8624.7700 * emsq + 5341.4  * eoc;
<a name="l00210"></a>00210                }
<a name="l00211"></a>00211                <span class="keywordflow">else</span>
<a name="l00212"></a>00212                {
<a name="l00213"></a>00213                  g533 =-37995.780 + 161616.52 * em - 229838.20 * emsq + 109377.94 * eoc;
<a name="l00214"></a>00214                  g521 =-51752.104 + 218913.95 * em - 309468.16 * emsq + 146349.42 * eoc;
<a name="l00215"></a>00215                  g532 =-40023.880 + 170470.89 * em - 242699.48 * emsq + 115605.82 * eoc;
<a name="l00216"></a>00216                }
<a name="l00217"></a>00217 
<a name="l00218"></a>00218              sini2=  sinim * sinim;
<a name="l00219"></a>00219              f220 =  0.75 * (1.0 + 2.0 * cosim+cosisq);
<a name="l00220"></a>00220              f221 =  1.5 * sini2;
<a name="l00221"></a>00221              f321 =  1.875 * sinim  *  (1.0 - 2.0 * cosim - 3.0 * cosisq);
<a name="l00222"></a>00222              f322 = -1.875 * sinim  *  (1.0 + 2.0 * cosim - 3.0 * cosisq);
<a name="l00223"></a>00223              f441 = 35.0 * sini2 * f220;
<a name="l00224"></a>00224              f442 = 39.3750 * sini2 * sini2;
<a name="l00225"></a>00225              f522 =  9.84375 * sinim * (sini2 * (1.0 - 2.0 * cosim- 5.0 * cosisq) +
<a name="l00226"></a>00226                      0.33333333 * (-2.0 + 4.0 * cosim + 6.0 * cosisq) );
<a name="l00227"></a>00227              f523 = sinim * (4.92187512 * sini2 * (-2.0 - 4.0 * cosim +
<a name="l00228"></a>00228                     10.0 * cosisq) + 6.56250012 * (1.0+2.0 * cosim - 3.0 * cosisq));
<a name="l00229"></a>00229              f542 = 29.53125 * sinim * (2.0 - 8.0 * cosim+cosisq *
<a name="l00230"></a>00230                     (-12.0 + 8.0 * cosim + 10.0 * cosisq));
<a name="l00231"></a>00231              f543 = 29.53125 * sinim * (-2.0 - 8.0 * cosim+cosisq *
<a name="l00232"></a>00232                     (12.0 + 8.0 * cosim - 10.0 * cosisq));
<a name="l00233"></a>00233              xno2  =  nm * nm;
<a name="l00234"></a>00234              ainv2 =  aonv * aonv;
<a name="l00235"></a>00235              temp1 =  3.0 * xno2 * ainv2;
<a name="l00236"></a>00236              temp  =  temp1 * root22;
<a name="l00237"></a>00237              satrec-&gt;<a class="code" href="classelsetrec.html#a10fca05e766eb5205b83a8fb5d94f727">setD2201</a>(temp * f220 * g201);
<a name="l00238"></a>00238              satrec-&gt;<a class="code" href="classelsetrec.html#a3cea43c7e2e535106ba412dc9d482800">setD2211</a>(temp * f221 * g211);
<a name="l00239"></a>00239              temp1 =  temp1 * aonv;
<a name="l00240"></a>00240              temp  =  temp1 * root32;
<a name="l00241"></a>00241              satrec-&gt;<a class="code" href="classelsetrec.html#a30e98787dfe580e747228f43727de0c5">setD3210</a>(temp * f321 * g310);
<a name="l00242"></a>00242              satrec-&gt;<a class="code" href="classelsetrec.html#a3fb909307edeb0c5e798702897121168">setD3222</a>(temp * f322 * g322);
<a name="l00243"></a>00243              temp1 =  temp1 * aonv;
<a name="l00244"></a>00244              temp  =  2.0 * temp1 * root44;
<a name="l00245"></a>00245              satrec-&gt;<a class="code" href="classelsetrec.html#a8e4fb3e30d2e0a2f65069eb42edf3d1b">setD4410</a>(temp * f441 * g410);
<a name="l00246"></a>00246              satrec-&gt;<a class="code" href="classelsetrec.html#afffe92a99c88dbcb2777b8fdfef5f8bb">setD4422</a>(temp * f442 * g422);
<a name="l00247"></a>00247              temp1 =  temp1 * aonv;
<a name="l00248"></a>00248              temp  =  temp1 * root52;
<a name="l00249"></a>00249              satrec-&gt;<a class="code" href="classelsetrec.html#a277e6eeb8f7f83c6dba0e907a8593575">setD5220</a>(temp * f522 * g520);
<a name="l00250"></a>00250              satrec-&gt;<a class="code" href="classelsetrec.html#a922764d812c5962e707e22bbd760f4a1">setD5232</a>(temp * f523 * g532);
<a name="l00251"></a>00251              temp  =  2.0 * temp1 * root54;
<a name="l00252"></a>00252              satrec-&gt;<a class="code" href="classelsetrec.html#adf54d3194197944221d9c765cde0019e">setD5421</a>(temp * f542 * g521);
<a name="l00253"></a>00253              satrec-&gt;<a class="code" href="classelsetrec.html#ab60876f8af3beb148f21a8c982069b1c">setD5433</a>(temp * f543 * g533);
<a name="l00254"></a>00254              satrec-&gt;<a class="code" href="classelsetrec.html#ac2e0f574cd59810c0b3d5d8d3766d01e">setXlamo</a>(fmod(satrec-&gt;<a class="code" href="classelsetrec.html#a68b23c77320e1f54f23b92ec62693ae9">getMo</a>() + satrec-&gt;<a class="code" href="classelsetrec.html#ae9c47ab8e47b5f321c2a1681667ebca1">getNodeo</a>() + satrec-&gt;<a class="code" href="classelsetrec.html#ae9c47ab8e47b5f321c2a1681667ebca1">getNodeo</a>()-theta - theta, twopi));
<a name="l00255"></a>00255              satrec-&gt;<a class="code" href="classelsetrec.html#a739e9195490083b604dc378d9376beaa">setXfact</a>(satrec-&gt;<a class="code" href="classelsetrec.html#a2cb8861a2f2caf5fc41908572fdf3697">getMdot</a>() + satrec-&gt;<a class="code" href="classelsetrec.html#aca1dc0706d64d34ee482c2ac38aaf4f6">getDmdt</a>() + 2.0 * (satrec-&gt;<a class="code" href="classelsetrec.html#acdbe034d127f4c528fd4a817377073dd">getNodedot</a>() + satrec-&gt;<a class="code" href="classelsetrec.html#a35ef1187bf8b78a21080b328663a50c1">getDnodt</a>() - rptim) - satrec-&gt;<a class="code" href="classelsetrec.html#a9d35bbf23b765047af74635f402f95d0">getNo</a>());
<a name="l00256"></a>00256              em    = emo;
<a name="l00257"></a>00257              emsq  = emsqo;
<a name="l00258"></a>00258            }
<a name="l00259"></a>00259 
<a name="l00260"></a>00260          <span class="comment">/* ---------------- synchronous resonance terms -------------- */</span>
<a name="l00261"></a>00261          <span class="keywordflow">if</span> (satrec-&gt;<a class="code" href="classelsetrec.html#ab6fb613a8a25fdc3e22777c9ce68c320">getIrez</a>() == 1)
<a name="l00262"></a>00262            {
<a name="l00263"></a>00263              g200  = 1.0 + emsq * (-2.5 + 0.8125 * emsq);
<a name="l00264"></a>00264              g310  = 1.0 + 2.0 * emsq;
<a name="l00265"></a>00265              g300  = 1.0 + emsq * (-6.0 + 6.60937 * emsq);
<a name="l00266"></a>00266              f220  = 0.75 * (1.0 + cosim) * (1.0 + cosim);
<a name="l00267"></a>00267              f311  = 0.9375 * sinim * sinim * (1.0 + 3.0 * cosim) - 0.75 * (1.0 + cosim);
<a name="l00268"></a>00268              f330  = 1.0 + cosim;
<a name="l00269"></a>00269              f330  = 1.875 * f330 * f330 * f330;
<a name="l00270"></a>00270              satrec-&gt;<a class="code" href="classelsetrec.html#ad3373297f93e4c2b1fd83c7719303e2b">setDel1</a>(3.0 * nm * nm * aonv * aonv);
<a name="l00271"></a>00271              satrec-&gt;<a class="code" href="classelsetrec.html#a020200fb7f09366ad2381f6779679f51">setDel2</a>(2.0 * satrec-&gt;<a class="code" href="classelsetrec.html#adbe205567e577bccaa18584a2a98e6a9">getDel1</a>() * f220 * g200 * q22);
<a name="l00272"></a>00272              satrec-&gt;<a class="code" href="classelsetrec.html#aa37c9cb43303906487fea25914626ba4">setDel3</a>(3.0 * satrec-&gt;<a class="code" href="classelsetrec.html#adbe205567e577bccaa18584a2a98e6a9">getDel1</a>() * f330 * g300 * q33 * aonv);
<a name="l00273"></a>00273              satrec-&gt;<a class="code" href="classelsetrec.html#ad3373297f93e4c2b1fd83c7719303e2b">setDel1</a>(satrec-&gt;<a class="code" href="classelsetrec.html#adbe205567e577bccaa18584a2a98e6a9">getDel1</a>() * f311 * g310 * q31 * aonv);
<a name="l00274"></a>00274              satrec-&gt;<a class="code" href="classelsetrec.html#ac2e0f574cd59810c0b3d5d8d3766d01e">setXlamo</a>(fmod(satrec-&gt;<a class="code" href="classelsetrec.html#a68b23c77320e1f54f23b92ec62693ae9">getMo</a>() + satrec-&gt;<a class="code" href="classelsetrec.html#ae9c47ab8e47b5f321c2a1681667ebca1">getNodeo</a>() + satrec-&gt;<a class="code" href="classelsetrec.html#a8277731f022d9bae8a04db99c41f8250">getArgpo</a>() - theta, twopi));
<a name="l00275"></a>00275              satrec-&gt;<a class="code" href="classelsetrec.html#a739e9195490083b604dc378d9376beaa">setXfact</a>(satrec-&gt;<a class="code" href="classelsetrec.html#a2cb8861a2f2caf5fc41908572fdf3697">getMdot</a>() + xpidot - rptim + satrec-&gt;<a class="code" href="classelsetrec.html#aca1dc0706d64d34ee482c2ac38aaf4f6">getDmdt</a>() + satrec-&gt;<a class="code" href="classelsetrec.html#ab4315aae38fd2eea08f3e884e7c0b55b">getDomdt</a>() + satrec-&gt;<a class="code" href="classelsetrec.html#a35ef1187bf8b78a21080b328663a50c1">getDnodt</a>() - satrec-&gt;<a class="code" href="classelsetrec.html#a9d35bbf23b765047af74635f402f95d0">getNo</a>());
<a name="l00276"></a>00276            }
<a name="l00277"></a>00277 
<a name="l00278"></a>00278          <span class="comment">/* ------------ for sgp4, initialize the integrator ---------- */</span>
<a name="l00279"></a>00279          satrec-&gt;<a class="code" href="classelsetrec.html#a2f8c5e6e3385e9de0f33eed6310213af">setXli</a>(satrec-&gt;<a class="code" href="classelsetrec.html#aca1345ab539d86e60c8cf04147b61026">getXlamo</a>());
<a name="l00280"></a>00280          satrec-&gt;<a class="code" href="classelsetrec.html#a18214911f6c5d59501677516f5d43384">setXni</a>(satrec-&gt;<a class="code" href="classelsetrec.html#a9d35bbf23b765047af74635f402f95d0">getNo</a>());
<a name="l00281"></a>00281          satrec-&gt;<a class="code" href="classelsetrec.html#ae3d173312be8b5882abc7123b70d0a43">setAtime</a>(0.0);
<a name="l00282"></a>00282          nm    = satrec-&gt;<a class="code" href="classelsetrec.html#a9d35bbf23b765047af74635f402f95d0">getNo</a>() + dndt;
<a name="l00283"></a>00283        }
<a name="l00284"></a>00284 
<a name="l00285"></a>00285 <span class="comment">//#include &quot;debug3.cpp&quot;</span>
<a name="l00286"></a>00286 }  <span class="comment">// end dsinit</span>
<a name="l00287"></a>00287 
<a name="l00298"></a>00298 <span class="keywordtype">void</span> Sgp4unit::dpper
<a name="l00299"></a>00299 (
<a name="l00300"></a>00300 
<a name="l00301"></a>00301   <span class="keywordtype">double</span> inclo,
<a name="l00302"></a>00302   <span class="keywordtype">char</span> init,
<a name="l00303"></a>00303   <span class="keywordtype">double</span>&amp; ep,    <span class="keywordtype">double</span>&amp; inclp, <span class="keywordtype">double</span>&amp; nodep,  <span class="keywordtype">double</span>&amp; argpp, <span class="keywordtype">double</span>&amp; mp
<a name="l00304"></a>00304 )
<a name="l00305"></a>00305 {
<a name="l00306"></a>00306         <span class="comment">/*</span>
<a name="l00307"></a>00307 <span class="comment">         * (</span>
<a name="l00308"></a>00308 <span class="comment">                                inclm, satrec-&gt;init,</span>
<a name="l00309"></a>00309 <span class="comment">                                satrec-&gt;ecco, satrec-&gt;inclo, satrec-&gt;nodeo, satrec-&gt;argpo, satrec-&gt;mo,</span>
<a name="l00310"></a>00310 <span class="comment"></span>
<a name="l00311"></a>00311 <span class="comment">                              );</span>
<a name="l00312"></a>00312 <span class="comment">                               dpper</span>
<a name="l00313"></a>00313 <span class="comment">             (</span>
<a name="l00314"></a>00314 <span class="comment">               satrec-&gt;inclo,</span>
<a name="l00315"></a>00315 <span class="comment">               &#39;n&#39;, ep, xincp, nodep, argpp, mp</span>
<a name="l00316"></a>00316 <span class="comment">             );</span>
<a name="l00317"></a>00317 <span class="comment">         */</span>
<a name="l00318"></a>00318 <span class="comment">/* --------------------- local variables ------------------------ */</span>
<a name="l00319"></a>00319 <span class="keyword">const</span> <span class="keywordtype">double</span> twopi = 2.0 * <a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>;
<a name="l00320"></a>00320 <span class="keywordtype">double</span> alfdp, betdp, cosip, cosop, dalf, dbet, dls,
<a name="l00321"></a>00321      f2,    f3,    pe,    pgh,   ph,   pinc, pl ,
<a name="l00322"></a>00322      sel,   ses,   sghl,  sghs,  shll, shs,  sil,
<a name="l00323"></a>00323      sinip, sinop, sinzf, sis,   sll,  sls,  xls,
<a name="l00324"></a>00324      xnoh,  zf,    zm,    zel,   zes,  znl,  zns;
<a name="l00325"></a>00325 
<a name="l00326"></a>00326 <span class="comment">/* ---------------------- constants ----------------------------- */</span>
<a name="l00327"></a>00327 zns   = 1.19459e-5;
<a name="l00328"></a>00328 zes   = 0.01675;
<a name="l00329"></a>00329 znl   = 1.5835218e-4;
<a name="l00330"></a>00330 zel   = 0.05490;
<a name="l00331"></a>00331 
<a name="l00332"></a>00332 <span class="comment">/* --------------- calculate time varying periodics ----------- */</span>
<a name="l00333"></a>00333 zm    = satrec-&gt;<a class="code" href="classelsetrec.html#adb7efad812bde1d5fd817f52e64afc48">getZmos</a>() + zns * satrec-&gt;<a class="code" href="classelsetrec.html#a350c57362f816a4668ddbeecf0fb50e5">getT</a>();
<a name="l00334"></a>00334 <span class="comment">// be sure that the initial call has time set to zero</span>
<a name="l00335"></a>00335 <span class="keywordflow">if</span> (init == <span class="charliteral">&#39;y&#39;</span>)
<a name="l00336"></a>00336     zm = satrec-&gt;<a class="code" href="classelsetrec.html#adb7efad812bde1d5fd817f52e64afc48">getZmos</a>();
<a name="l00337"></a>00337 zf    = zm + 2.0 * zes * sin(zm);
<a name="l00338"></a>00338 sinzf = sin(zf);
<a name="l00339"></a>00339 f2    =  0.5 * sinzf * sinzf - 0.25;
<a name="l00340"></a>00340 f3    = -0.5 * sinzf * cos(zf);
<a name="l00341"></a>00341 ses   = satrec-&gt;<a class="code" href="classelsetrec.html#a8d0a286cd650b990f22304048c036ccd">getSe2</a>()* f2 + satrec-&gt;<a class="code" href="classelsetrec.html#a7fc587a74b7fdd32d094d98e7e3510cb">getSe3</a>() * f3;
<a name="l00342"></a>00342 sis   = satrec-&gt;<a class="code" href="classelsetrec.html#a4ec1d9e3a8b47517cab3a0a11f946cce">getSi2</a>() * f2 + satrec-&gt;<a class="code" href="classelsetrec.html#a0f29ac1ca058b0a50c55950217bdde78">getSi3</a>() * f3;
<a name="l00343"></a>00343 sls   = satrec-&gt;<a class="code" href="classelsetrec.html#a228f5bf618b8c0e51556f86609acf3f7">getSl2</a>() * f2 + satrec-&gt;<a class="code" href="classelsetrec.html#a81664c2b57e0295154b181ef7d4e6a95">getSl3</a>() * f3 + satrec-&gt;<a class="code" href="classelsetrec.html#a474a02787f43b04c41a9fa2985e43244">getSl4</a>() * sinzf;
<a name="l00344"></a>00344 sghs  = satrec-&gt;<a class="code" href="classelsetrec.html#a88a032a27cc4c5b1b3863fb84d473e03">getSgh2</a>() * f2 + satrec-&gt;<a class="code" href="classelsetrec.html#abbfe8d4775b0868067fb87f594012f4f">getSgh3</a>() * f3 + satrec-&gt;<a class="code" href="classelsetrec.html#a0c9e08bd6486a4dcacfec6a9ad746c07">getSgh4</a>() * sinzf;
<a name="l00345"></a>00345 shs   = satrec-&gt;<a class="code" href="classelsetrec.html#adbc930247d658067032dbd65c348e858">getSh2</a>() * f2 + satrec-&gt;<a class="code" href="classelsetrec.html#a0f1bc6331eb065ba7d80ce1caf086f6d">getSh3</a>() * f3;
<a name="l00346"></a>00346 zm    = satrec-&gt;<a class="code" href="classelsetrec.html#a214dbc656855555881e3aa74d11a6fd9">getZmol</a>() + znl * satrec-&gt;<a class="code" href="classelsetrec.html#a350c57362f816a4668ddbeecf0fb50e5">getT</a>();
<a name="l00347"></a>00347 <span class="keywordflow">if</span> (init == <span class="charliteral">&#39;y&#39;</span>)
<a name="l00348"></a>00348     zm = satrec-&gt;<a class="code" href="classelsetrec.html#a214dbc656855555881e3aa74d11a6fd9">getZmol</a>();
<a name="l00349"></a>00349 zf    = zm + 2.0 * zel * sin(zm);
<a name="l00350"></a>00350 sinzf = sin(zf);
<a name="l00351"></a>00351 f2    =  0.5 * sinzf * sinzf - 0.25;
<a name="l00352"></a>00352 f3    = -0.5 * sinzf * cos(zf);
<a name="l00353"></a>00353 sel   = satrec-&gt;<a class="code" href="classelsetrec.html#aec8a6076a29227a834b28d5268e4bf58">getEe2</a>() * f2 + satrec-&gt;<a class="code" href="classelsetrec.html#a0d7a0293d0b57fac08d753b4c566b09d">getE3</a>() * f3;
<a name="l00354"></a>00354 sil   = satrec-&gt;<a class="code" href="classelsetrec.html#a23220441d841a1c684b20a59ebfad23d">getXi2</a>() * f2 + satrec-&gt;<a class="code" href="classelsetrec.html#ade04059005f6cdc26dee5a2a867dfc95">getXi3</a>() * f3;
<a name="l00355"></a>00355 sll   = satrec-&gt;<a class="code" href="classelsetrec.html#af36dd0ff678853797fcf51473c7e75b7">getXl2</a>() * f2 + satrec-&gt;<a class="code" href="classelsetrec.html#a1c7fe2343e66f2c05c527cd9898236bf">getXl3</a>() * f3 + satrec-&gt;<a class="code" href="classelsetrec.html#a75777007cde26530837f0200c2055b85">getXl4</a>() * sinzf;
<a name="l00356"></a>00356 sghl  = satrec-&gt;<a class="code" href="classelsetrec.html#a4853555b12c03b4813680e351ddc16fe">getXgh2</a>() * f2 + satrec-&gt;<a class="code" href="classelsetrec.html#a5717b68ff4a029b81e68480ee4588934">getXgh3</a>() * f3 + satrec-&gt;<a class="code" href="classelsetrec.html#ae91a41495619df9f34daf2d757ce158b">getXgh4</a>() * sinzf;
<a name="l00357"></a>00357 shll  = satrec-&gt;<a class="code" href="classelsetrec.html#a36d7e5c03ac15fe689eeb093e5a81ca0">getXh2</a>() * f2 + satrec-&gt;<a class="code" href="classelsetrec.html#a9b6fa4438a8260f29581b16f29a42659">getXh3</a>() * f3;
<a name="l00358"></a>00358 pe    = ses + sel;
<a name="l00359"></a>00359 pinc  = sis + sil;
<a name="l00360"></a>00360 pl    = sls + sll;
<a name="l00361"></a>00361 pgh   = sghs + sghl;
<a name="l00362"></a>00362 ph    = shs + shll;
<a name="l00363"></a>00363 
<a name="l00364"></a>00364 <span class="keywordflow">if</span> (init == <span class="charliteral">&#39;n&#39;</span>)
<a name="l00365"></a>00365   {
<a name="l00366"></a>00366   pe    = pe - satrec-&gt;<a class="code" href="classelsetrec.html#a6cf6b2dc9745aa24db0b2cb191cd5e72">getPeo</a>();
<a name="l00367"></a>00367   pinc  = pinc - satrec-&gt;<a class="code" href="classelsetrec.html#a55d81b1dc276d3f0532472db3e0f5666">getPinco</a>();
<a name="l00368"></a>00368   pl    = pl - satrec-&gt;<a class="code" href="classelsetrec.html#ac2e6c11d7650c128e7c6e4686654768b">getPlo</a>();
<a name="l00369"></a>00369   pgh   = pgh - satrec-&gt;<a class="code" href="classelsetrec.html#a9d71d46dffd5718935bffe032d8b6c65">getPgho</a>();
<a name="l00370"></a>00370   ph    = ph - satrec-&gt;<a class="code" href="classelsetrec.html#ab94eb71680e3e3478362f2ee3a1dc92e">getPho</a>();
<a name="l00371"></a>00371   inclp = inclp + pinc;
<a name="l00372"></a>00372   ep    = ep + pe;
<a name="l00373"></a>00373   sinip = sin(inclp);
<a name="l00374"></a>00374   cosip = cos(inclp);
<a name="l00375"></a>00375 
<a name="l00376"></a>00376   <span class="comment">/* ----------------- apply periodics directly ------------ */</span>
<a name="l00377"></a>00377   <span class="comment">//  sgp4fix for lyddane choice</span>
<a name="l00378"></a>00378   <span class="comment">//  strn3 used original inclination - this is technically feasible</span>
<a name="l00379"></a>00379   <span class="comment">//  gsfc used perturbed inclination - also technically feasible</span>
<a name="l00380"></a>00380   <span class="comment">//  probably best to readjust the 0.2 limit value and limit discontinuity</span>
<a name="l00381"></a>00381   <span class="comment">//  0.2 rad = 11.45916 deg</span>
<a name="l00382"></a>00382   <span class="comment">//  use next line for original strn3 approach and original inclination</span>
<a name="l00383"></a>00383   <span class="comment">//  if (inclo &gt;= 0.2)</span>
<a name="l00384"></a>00384   <span class="comment">//  use next line for gsfc version and perturbed inclination</span>
<a name="l00385"></a>00385   <span class="keywordflow">if</span> (inclp &gt;= 0.2)
<a name="l00386"></a>00386     {
<a name="l00387"></a>00387       ph     = ph / sinip;
<a name="l00388"></a>00388       pgh    = pgh - cosip * ph;
<a name="l00389"></a>00389       argpp  = argpp + pgh;
<a name="l00390"></a>00390       nodep  = nodep + ph;
<a name="l00391"></a>00391       mp     = mp + pl;
<a name="l00392"></a>00392     }
<a name="l00393"></a>00393     <span class="keywordflow">else</span>
<a name="l00394"></a>00394     {
<a name="l00395"></a>00395       <span class="comment">/* ---- apply periodics with lyddane modification ---- */</span>
<a name="l00396"></a>00396       sinop  = sin(nodep);
<a name="l00397"></a>00397       cosop  = cos(nodep);
<a name="l00398"></a>00398       alfdp  = sinip * sinop;
<a name="l00399"></a>00399       betdp  = sinip * cosop;
<a name="l00400"></a>00400       dalf   =  ph * cosop + pinc * cosip * sinop;
<a name="l00401"></a>00401       dbet   = -ph * sinop + pinc * cosip * cosop;
<a name="l00402"></a>00402       alfdp  = alfdp + dalf;
<a name="l00403"></a>00403       betdp  = betdp + dbet;
<a name="l00404"></a>00404       nodep  = fmod(nodep, twopi);
<a name="l00405"></a>00405       <span class="comment">//  sgp4fix for afspc written intrinsic functions</span>
<a name="l00406"></a>00406       <span class="comment">// nodep used without a trigonometric function ahead</span>
<a name="l00407"></a>00407 
<a name="l00408"></a>00408       <span class="keywordflow">if</span> ((nodep &lt; 0.0) &amp;&amp; (satrec-&gt;<a class="code" href="classelsetrec.html#a723fcbade6a8ddc7be174d7d89dc0fc8">getOperationmode</a>() == <span class="charliteral">&#39;a&#39;</span>))
<a name="l00409"></a>00409           nodep = nodep + twopi;
<a name="l00410"></a>00410       xls    = mp + argpp + cosip * nodep;
<a name="l00411"></a>00411       dls    = pl + pgh - pinc * nodep * sinip;
<a name="l00412"></a>00412       xls    = xls + dls;
<a name="l00413"></a>00413       xnoh   = nodep;
<a name="l00414"></a>00414       nodep  = atan2(alfdp, betdp);
<a name="l00415"></a>00415       <span class="comment">//  sgp4fix for afspc written intrinsic functions</span>
<a name="l00416"></a>00416       <span class="comment">// nodep used without a trigonometric function ahead</span>
<a name="l00417"></a>00417       <span class="keywordflow">if</span> ((nodep &lt; 0.0) &amp;&amp; (satrec-&gt;<a class="code" href="classelsetrec.html#a723fcbade6a8ddc7be174d7d89dc0fc8">getOperationmode</a>() == <span class="charliteral">&#39;a&#39;</span>))
<a name="l00418"></a>00418           nodep = nodep + twopi;
<a name="l00419"></a>00419       <span class="keywordflow">if</span> (fabs(xnoh - nodep) &gt; <a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>){
<a name="l00420"></a>00420         <span class="keywordflow">if</span> (nodep &lt; xnoh)
<a name="l00421"></a>00421            nodep = nodep + twopi;
<a name="l00422"></a>00422           <span class="keywordflow">else</span>
<a name="l00423"></a>00423            nodep = nodep - twopi;}
<a name="l00424"></a>00424       mp    = mp + pl;
<a name="l00425"></a>00425       argpp = xls - mp - cosip * nodep;
<a name="l00426"></a>00426     }
<a name="l00427"></a>00427   }   <span class="comment">// if init == &#39;n&#39;</span>
<a name="l00428"></a>00428 
<a name="l00429"></a>00429 <span class="comment">//#include &quot;debug1.cpp&quot;</span>
<a name="l00430"></a>00430 }  <span class="comment">// end dpper</span>
<a name="l00431"></a>00431 
<a name="l00487"></a>00487 <span class="keywordtype">void</span> Sgp4unit::dscom
<a name="l00488"></a>00488      (
<a name="l00489"></a>00489        <span class="keywordtype">double</span> epoch, <span class="keywordtype">double</span> tc,
<a name="l00490"></a>00490        <span class="keywordtype">double</span>&amp; snodm, <span class="keywordtype">double</span>&amp; cnodm, <span class="keywordtype">double</span>&amp; sinim,  <span class="keywordtype">double</span>&amp; cosim, <span class="keywordtype">double</span>&amp; sinomm,
<a name="l00491"></a>00491        <span class="keywordtype">double</span>&amp; cosomm,<span class="keywordtype">double</span>&amp; day,   <span class="keywordtype">double</span>&amp; em,
<a name="l00492"></a>00492        <span class="keywordtype">double</span>&amp; emsq,  <span class="keywordtype">double</span>&amp; gam,   <span class="keywordtype">double</span>&amp; rtemsq,
<a name="l00493"></a>00493        <span class="keywordtype">double</span>&amp; s1,    <span class="keywordtype">double</span>&amp; s2,    <span class="keywordtype">double</span>&amp; s3,     <span class="keywordtype">double</span>&amp; s4,    <span class="keywordtype">double</span>&amp; s5,
<a name="l00494"></a>00494        <span class="keywordtype">double</span>&amp; s6,    <span class="keywordtype">double</span>&amp; s7,    <span class="keywordtype">double</span>&amp; ss1,    <span class="keywordtype">double</span>&amp; ss2,   <span class="keywordtype">double</span>&amp; ss3,
<a name="l00495"></a>00495        <span class="keywordtype">double</span>&amp; ss4,   <span class="keywordtype">double</span>&amp; ss5,   <span class="keywordtype">double</span>&amp; ss6,    <span class="keywordtype">double</span>&amp; ss7,   <span class="keywordtype">double</span>&amp; sz1,
<a name="l00496"></a>00496        <span class="keywordtype">double</span>&amp; sz2,   <span class="keywordtype">double</span>&amp; sz3,   <span class="keywordtype">double</span>&amp; sz11,   <span class="keywordtype">double</span>&amp; sz12,  <span class="keywordtype">double</span>&amp; sz13,
<a name="l00497"></a>00497        <span class="keywordtype">double</span>&amp; sz21,  <span class="keywordtype">double</span>&amp; sz22,  <span class="keywordtype">double</span>&amp; sz23,   <span class="keywordtype">double</span>&amp; sz31,  <span class="keywordtype">double</span>&amp; sz32,
<a name="l00498"></a>00498        <span class="keywordtype">double</span>&amp; sz33,  <span class="keywordtype">double</span>&amp; nm,    <span class="keywordtype">double</span>&amp; z1,     <span class="keywordtype">double</span>&amp; z2,    <span class="keywordtype">double</span>&amp; z3,
<a name="l00499"></a>00499        <span class="keywordtype">double</span>&amp; z11,   <span class="keywordtype">double</span>&amp; z12,   <span class="keywordtype">double</span>&amp; z13,    <span class="keywordtype">double</span>&amp; z21,   <span class="keywordtype">double</span>&amp; z22,
<a name="l00500"></a>00500        <span class="keywordtype">double</span>&amp; z23,   <span class="keywordtype">double</span>&amp; z31,   <span class="keywordtype">double</span>&amp; z32,    <span class="keywordtype">double</span>&amp; z33
<a name="l00501"></a>00501      )
<a name="l00502"></a>00502 
<a name="l00503"></a>00503 {
<a name="l00504"></a>00504         <span class="comment">/*dscom</span>
<a name="l00505"></a>00505 <span class="comment">                 (</span>
<a name="l00506"></a>00506 <span class="comment">                   epoch, tc, snodm, cnodm,  sinim, cosim,sinomm,     cosomm,</span>
<a name="l00507"></a>00507 <span class="comment">                   day,em,         emsq, gam,</span>
<a name="l00508"></a>00508 <span class="comment">                   rtemsq, s1, s2, s3, s4, s5,</span>
<a name="l00509"></a>00509 <span class="comment">                   s6,   s7,   ss1,  ss2,  ss3,  ss4,  ss5,  ss6,  ss7, sz1, sz2, sz3,</span>
<a name="l00510"></a>00510 <span class="comment">                   sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33,</span>
<a name="l00511"></a>00511 <span class="comment">                   nm, z1, z2, z3, z11,</span>
<a name="l00512"></a>00512 <span class="comment">                   z12, z13, z21, z22, z23, z31, z32, z33,</span>
<a name="l00513"></a>00513 <span class="comment">                   </span>
<a name="l00514"></a>00514 <span class="comment">                 );</span>
<a name="l00515"></a>00515 <span class="comment">     /* -------------------------- constants ------------------------- */</span>
<a name="l00516"></a>00516      <span class="keyword">const</span> <span class="keywordtype">double</span> zes     =  0.01675;
<a name="l00517"></a>00517      <span class="keyword">const</span> <span class="keywordtype">double</span> zel     =  0.05490;
<a name="l00518"></a>00518      <span class="keyword">const</span> <span class="keywordtype">double</span> c1ss    =  2.9864797e-6;
<a name="l00519"></a>00519      <span class="keyword">const</span> <span class="keywordtype">double</span> c1l     =  4.7968065e-7;
<a name="l00520"></a>00520      <span class="keyword">const</span> <span class="keywordtype">double</span> zsinis  =  0.39785416;
<a name="l00521"></a>00521      <span class="keyword">const</span> <span class="keywordtype">double</span> zcosis  =  0.91744867;
<a name="l00522"></a>00522      <span class="keyword">const</span> <span class="keywordtype">double</span> zcosgs  =  0.1945905;
<a name="l00523"></a>00523      <span class="keyword">const</span> <span class="keywordtype">double</span> zsings  = -0.98088458;
<a name="l00524"></a>00524      <span class="keyword">const</span> <span class="keywordtype">double</span> twopi   =  2.0 * <a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>;
<a name="l00525"></a>00525 
<a name="l00526"></a>00526      <span class="comment">/* --------------------- local variables ------------------------ */</span>
<a name="l00527"></a>00527      <span class="keywordtype">int</span> lsflg;
<a name="l00528"></a>00528      <span class="keywordtype">double</span> a1    , a2    , a3    , a4    , a5    , a6    , a7    ,
<a name="l00529"></a>00529         a8    , a9    , a10   , betasq, cc    , ctem  , stem  ,
<a name="l00530"></a>00530         x1    , x2    , x3    , x4    , x5    , x6    , x7    ,
<a name="l00531"></a>00531         x8    , xnodce, xnoi  , zcosg , zcosgl, zcosh , zcoshl,
<a name="l00532"></a>00532         zcosi , zcosil, zsing , zsingl, zsinh , zsinhl, zsini ,
<a name="l00533"></a>00533         zsinil, zx    , zy;
<a name="l00534"></a>00534 
<a name="l00535"></a>00535      nm     = satrec-&gt;<a class="code" href="classelsetrec.html#a9d35bbf23b765047af74635f402f95d0">getNo</a>();
<a name="l00536"></a>00536      em     = satrec-&gt;<a class="code" href="classelsetrec.html#a6ae438d068b3152b1a706b246995092e">getEcco</a>();
<a name="l00537"></a>00537      snodm  = sin(satrec-&gt;<a class="code" href="classelsetrec.html#ae9c47ab8e47b5f321c2a1681667ebca1">getNodeo</a>());
<a name="l00538"></a>00538      cnodm  = cos(satrec-&gt;<a class="code" href="classelsetrec.html#ae9c47ab8e47b5f321c2a1681667ebca1">getNodeo</a>());
<a name="l00539"></a>00539      sinomm = sin(satrec-&gt;<a class="code" href="classelsetrec.html#a8277731f022d9bae8a04db99c41f8250">getArgpo</a>());
<a name="l00540"></a>00540      cosomm = cos(satrec-&gt;<a class="code" href="classelsetrec.html#a8277731f022d9bae8a04db99c41f8250">getArgpo</a>());
<a name="l00541"></a>00541      sinim  = sin(satrec-&gt;<a class="code" href="classelsetrec.html#a94e0da477d5ada44187d768d6373144d">getInclo</a>());
<a name="l00542"></a>00542      cosim  = cos(satrec-&gt;<a class="code" href="classelsetrec.html#a94e0da477d5ada44187d768d6373144d">getInclo</a>());
<a name="l00543"></a>00543      emsq   = em * em;
<a name="l00544"></a>00544      betasq = 1.0 - emsq;
<a name="l00545"></a>00545      rtemsq = sqrt(betasq);
<a name="l00546"></a>00546 
<a name="l00547"></a>00547      <span class="comment">/* ----------------- initialize lunar solar terms --------------- */</span>
<a name="l00548"></a>00548      satrec-&gt;<a class="code" href="classelsetrec.html#a93d2639044e24a79e3cf4f504cadf1d3">setPeo</a>(0.0);
<a name="l00549"></a>00549      satrec-&gt;<a class="code" href="classelsetrec.html#a9d43a883f8623f78f0167c1c71ca98d9">setPinco</a>(0.0);
<a name="l00550"></a>00550      satrec-&gt;<a class="code" href="classelsetrec.html#a387db9771e34bd201d8734d5d08adec9">setPlo</a>(0.0);
<a name="l00551"></a>00551      satrec-&gt;<a class="code" href="classelsetrec.html#a25715eaae6659bde1c2edeecf2965f32">setPgho</a>(0.0);
<a name="l00552"></a>00552      satrec-&gt;<a class="code" href="classelsetrec.html#a8a1a6f85b8ea37064e275ad02f8930f1">setPho</a>(0.0);
<a name="l00553"></a>00553      day    = epoch + 18261.5 + tc / 1440.0;
<a name="l00554"></a>00554      xnodce = fmod(4.5236020 - 9.2422029e-4 * day, twopi);
<a name="l00555"></a>00555      stem   = sin(xnodce);
<a name="l00556"></a>00556      ctem   = cos(xnodce);
<a name="l00557"></a>00557      zcosil = 0.91375164 - 0.03568096 * ctem;
<a name="l00558"></a>00558      zsinil = sqrt(1.0 - zcosil * zcosil);
<a name="l00559"></a>00559      zsinhl = 0.089683511 * stem / zsinil;
<a name="l00560"></a>00560      zcoshl = sqrt(1.0 - zsinhl * zsinhl);
<a name="l00561"></a>00561      gam    = 5.8351514 + 0.0019443680 * day;
<a name="l00562"></a>00562      zx     = 0.39785416 * stem / zsinil;
<a name="l00563"></a>00563      zy     = zcoshl * ctem + 0.91744867 * zsinhl * stem;
<a name="l00564"></a>00564      zx     = atan2(zx, zy);
<a name="l00565"></a>00565      zx     = gam + zx - xnodce;
<a name="l00566"></a>00566      zcosgl = cos(zx);
<a name="l00567"></a>00567      zsingl = sin(zx);
<a name="l00568"></a>00568 
<a name="l00569"></a>00569      <span class="comment">/* ------------------------- do solar terms --------------------- */</span>
<a name="l00570"></a>00570      zcosg = zcosgs;
<a name="l00571"></a>00571      zsing = zsings;
<a name="l00572"></a>00572      zcosi = zcosis;
<a name="l00573"></a>00573      zsini = zsinis;
<a name="l00574"></a>00574      zcosh = cnodm;
<a name="l00575"></a>00575      zsinh = snodm;
<a name="l00576"></a>00576      cc    = c1ss;
<a name="l00577"></a>00577      xnoi  = 1.0 / nm;
<a name="l00578"></a>00578 
<a name="l00579"></a>00579      <span class="keywordflow">for</span> (lsflg = 1; lsflg &lt;= 2; lsflg++)
<a name="l00580"></a>00580        {
<a name="l00581"></a>00581          a1  =   zcosg * zcosh + zsing * zcosi * zsinh;
<a name="l00582"></a>00582          a3  =  -zsing * zcosh + zcosg * zcosi * zsinh;
<a name="l00583"></a>00583          a7  =  -zcosg * zsinh + zsing * zcosi * zcosh;
<a name="l00584"></a>00584          a8  =   zsing * zsini;
<a name="l00585"></a>00585          a9  =   zsing * zsinh + zcosg * zcosi * zcosh;
<a name="l00586"></a>00586          a10 =   zcosg * zsini;
<a name="l00587"></a>00587          a2  =   cosim * a7 + sinim * a8;
<a name="l00588"></a>00588          a4  =   cosim * a9 + sinim * a10;
<a name="l00589"></a>00589          a5  =  -sinim * a7 + cosim * a8;
<a name="l00590"></a>00590          a6  =  -sinim * a9 + cosim * a10;
<a name="l00591"></a>00591 
<a name="l00592"></a>00592          x1  =  a1 * cosomm + a2 * sinomm;
<a name="l00593"></a>00593          x2  =  a3 * cosomm + a4 * sinomm;
<a name="l00594"></a>00594          x3  = -a1 * sinomm + a2 * cosomm;
<a name="l00595"></a>00595          x4  = -a3 * sinomm + a4 * cosomm;
<a name="l00596"></a>00596          x5  =  a5 * sinomm;
<a name="l00597"></a>00597          x6  =  a6 * sinomm;
<a name="l00598"></a>00598          x7  =  a5 * cosomm;
<a name="l00599"></a>00599          x8  =  a6 * cosomm;
<a name="l00600"></a>00600 
<a name="l00601"></a>00601          z31 = 12.0 * x1 * x1 - 3.0 * x3 * x3;
<a name="l00602"></a>00602          z32 = 24.0 * x1 * x2 - 6.0 * x3 * x4;
<a name="l00603"></a>00603          z33 = 12.0 * x2 * x2 - 3.0 * x4 * x4;
<a name="l00604"></a>00604          z1  =  3.0 *  (a1 * a1 + a2 * a2) + z31 * emsq;
<a name="l00605"></a>00605          z2  =  6.0 *  (a1 * a3 + a2 * a4) + z32 * emsq;
<a name="l00606"></a>00606          z3  =  3.0 *  (a3 * a3 + a4 * a4) + z33 * emsq;
<a name="l00607"></a>00607          z11 = -6.0 * a1 * a5 + emsq *  (-24.0 * x1 * x7-6.0 * x3 * x5);
<a name="l00608"></a>00608          z12 = -6.0 *  (a1 * a6 + a3 * a5) + emsq *
<a name="l00609"></a>00609                 (-24.0 * (x2 * x7 + x1 * x8) - 6.0 * (x3 * x6 + x4 * x5));
<a name="l00610"></a>00610          z13 = -6.0 * a3 * a6 + emsq * (-24.0 * x2 * x8 - 6.0 * x4 * x6);
<a name="l00611"></a>00611          z21 =  6.0 * a2 * a5 + emsq * (24.0 * x1 * x5 - 6.0 * x3 * x7);
<a name="l00612"></a>00612          z22 =  6.0 *  (a4 * a5 + a2 * a6) + emsq *
<a name="l00613"></a>00613                 (24.0 * (x2 * x5 + x1 * x6) - 6.0 * (x4 * x7 + x3 * x8));
<a name="l00614"></a>00614          z23 =  6.0 * a4 * a6 + emsq * (24.0 * x2 * x6 - 6.0 * x4 * x8);
<a name="l00615"></a>00615          z1  = z1 + z1 + betasq * z31;
<a name="l00616"></a>00616          z2  = z2 + z2 + betasq * z32;
<a name="l00617"></a>00617          z3  = z3 + z3 + betasq * z33;
<a name="l00618"></a>00618          s3  = cc * xnoi;
<a name="l00619"></a>00619          s2  = -0.5 * s3 / rtemsq;
<a name="l00620"></a>00620          s4  = s3 * rtemsq;
<a name="l00621"></a>00621          s1  = -15.0 * em * s4;
<a name="l00622"></a>00622          s5  = x1 * x3 + x2 * x4;
<a name="l00623"></a>00623          s6  = x2 * x3 + x1 * x4;
<a name="l00624"></a>00624          s7  = x2 * x4 - x1 * x3;
<a name="l00625"></a>00625 
<a name="l00626"></a>00626          <span class="comment">/* ----------------------- do lunar terms ------------------- */</span>
<a name="l00627"></a>00627          <span class="keywordflow">if</span> (lsflg == 1)
<a name="l00628"></a>00628            {
<a name="l00629"></a>00629              ss1   = s1;
<a name="l00630"></a>00630              ss2   = s2;
<a name="l00631"></a>00631              ss3   = s3;
<a name="l00632"></a>00632              ss4   = s4;
<a name="l00633"></a>00633              ss5   = s5;
<a name="l00634"></a>00634              ss6   = s6;
<a name="l00635"></a>00635              ss7   = s7;
<a name="l00636"></a>00636              sz1   = z1;
<a name="l00637"></a>00637              sz2   = z2;
<a name="l00638"></a>00638              sz3   = z3;
<a name="l00639"></a>00639              sz11  = z11;
<a name="l00640"></a>00640              sz12  = z12;
<a name="l00641"></a>00641              sz13  = z13;
<a name="l00642"></a>00642              sz21  = z21;
<a name="l00643"></a>00643              sz22  = z22;
<a name="l00644"></a>00644              sz23  = z23;
<a name="l00645"></a>00645              sz31  = z31;
<a name="l00646"></a>00646              sz32  = z32;
<a name="l00647"></a>00647              sz33  = z33;
<a name="l00648"></a>00648              zcosg = zcosgl;
<a name="l00649"></a>00649              zsing = zsingl;
<a name="l00650"></a>00650              zcosi = zcosil;
<a name="l00651"></a>00651              zsini = zsinil;
<a name="l00652"></a>00652              zcosh = zcoshl * cnodm + zsinhl * snodm;
<a name="l00653"></a>00653              zsinh = snodm * zcoshl - cnodm * zsinhl;
<a name="l00654"></a>00654              cc    = c1l;
<a name="l00655"></a>00655           }
<a name="l00656"></a>00656        }
<a name="l00657"></a>00657 
<a name="l00658"></a>00658      satrec-&gt;<a class="code" href="classelsetrec.html#a29459bd3bfe7a380e0ba593089ddc9e4">setZmol</a>(fmod(4.7199672 + 0.22997150  * day - gam, twopi));
<a name="l00659"></a>00659      satrec-&gt;<a class="code" href="classelsetrec.html#af621f083fe13738f412315b50ef8746f">setZmos</a>(fmod(6.2565837 + 0.017201977 * day, twopi));
<a name="l00660"></a>00660 
<a name="l00661"></a>00661      <span class="comment">/* ------------------------ do solar terms ---------------------- */</span>
<a name="l00662"></a>00662      satrec-&gt;<a class="code" href="classelsetrec.html#ae7ae1665220ff753ac0d416e7ca2ac84">setSe2</a>(2.0 * ss1 * ss6);
<a name="l00663"></a>00663      satrec-&gt;<a class="code" href="classelsetrec.html#ac957e72a5a7f95cf5e875c887676d6f6">setSe3</a>(2.0 * ss1 * ss7);
<a name="l00664"></a>00664      satrec-&gt;<a class="code" href="classelsetrec.html#a708bf784c9cd06638cbda3b170d8a2d2">setSi2</a>(2.0 * ss2 * sz12);
<a name="l00665"></a>00665      satrec-&gt;<a class="code" href="classelsetrec.html#ad5c862692fc58ff188215709047ce21d">setSi3</a>(2.0 * ss2 * (sz13 - sz11));
<a name="l00666"></a>00666      satrec-&gt;<a class="code" href="classelsetrec.html#a4567cae5f88540c99cf5e83ff0eb40ec">setSl2</a>(-2.0 * ss3 * sz2);
<a name="l00667"></a>00667      satrec-&gt;<a class="code" href="classelsetrec.html#a441bb4639060b2985f21550c4f18b3a5">setSl3</a>(-2.0 * ss3 * (sz3 - sz1));
<a name="l00668"></a>00668      satrec-&gt;<a class="code" href="classelsetrec.html#ae9475fedc9d4e24003d928c876e86289">setSl4</a>(-2.0 * ss3 * (-21.0 - 9.0 * emsq) * zes);
<a name="l00669"></a>00669      satrec-&gt;<a class="code" href="classelsetrec.html#ac5daaa1ba69a6dac445d40f9ba61689b">setSgh2</a>(2.0 * ss4 * sz32);
<a name="l00670"></a>00670      satrec-&gt;<a class="code" href="classelsetrec.html#a501b2f462c56b0427adef456877ee813">setSgh3</a>(2.0 * ss4 * (sz33 - sz31));
<a name="l00671"></a>00671      satrec-&gt;<a class="code" href="classelsetrec.html#a38fae3565d0eefa8d9cb1c14cb4013fa">setSgh4</a>(-18.0 * ss4 * zes);
<a name="l00672"></a>00672      satrec-&gt;<a class="code" href="classelsetrec.html#ae46acf36b44dfd6c06e646ee920a3683">setSh2</a>(-2.0 * ss2 * sz22);
<a name="l00673"></a>00673      satrec-&gt;<a class="code" href="classelsetrec.html#a4ac25da19aa660c9b2504c9b1be22c50">setSh3</a>(-2.0 * ss2 * (sz23 - sz21));
<a name="l00674"></a>00674 
<a name="l00675"></a>00675      <span class="comment">/* ------------------------ do lunar terms ---------------------- */</span>
<a name="l00676"></a>00676      satrec-&gt;<a class="code" href="classelsetrec.html#a7e3163a18df8cc4bf40c67c623c9a57d">setEe2</a>(2.0 * s1 * s6);
<a name="l00677"></a>00677      satrec-&gt;<a class="code" href="classelsetrec.html#a40863257af077040cdeab090e2caafc0">setE3</a>(2.0 * s1 * s7);
<a name="l00678"></a>00678      satrec-&gt;<a class="code" href="classelsetrec.html#a4a25d220c41ec6228571d606790dd389">setXi2</a>(2.0 * s2 * z12);
<a name="l00679"></a>00679      satrec-&gt;<a class="code" href="classelsetrec.html#aa6741867628c4b4ce2751b153ee478d7">setXi3</a>(2.0 * s2 * (z13 - z11));
<a name="l00680"></a>00680      satrec-&gt;<a class="code" href="classelsetrec.html#a48a194730a2f2a88e986da9dbd76aa8b">setXl2</a>(-2.0 * s3 * z2);
<a name="l00681"></a>00681      satrec-&gt;<a class="code" href="classelsetrec.html#af2cdb291f3ca8b343f44b8123aefbf1b">setXl3</a>(-2.0 * s3 * (z3 - z1));
<a name="l00682"></a>00682      satrec-&gt;<a class="code" href="classelsetrec.html#acdb11938193c0b6ed00cca7187e9a902">setXl4</a>(-2.0 * s3 * (-21.0 - 9.0 * emsq) * zel);
<a name="l00683"></a>00683      satrec-&gt;<a class="code" href="classelsetrec.html#a1b92ba476a39d047bdd8eb5608533da1">setXgh2</a>(2.0 * s4 * z32);
<a name="l00684"></a>00684      satrec-&gt;<a class="code" href="classelsetrec.html#a2543694e9ce409a7734ecfbfe7742769">setXgh3</a>(2.0 * s4 * (z33 - z31));
<a name="l00685"></a>00685      satrec-&gt;<a class="code" href="classelsetrec.html#a80e330c1c4e51ebd4a5191861cb13fd2">setXgh4</a>(-18.0 * s4 * zel);
<a name="l00686"></a>00686      satrec-&gt;<a class="code" href="classelsetrec.html#ad8fcdc7fd5849a02ce1cedbca4e4dc7c">setXh2</a>(-2.0 * s2 * z22);
<a name="l00687"></a>00687      satrec-&gt;<a class="code" href="classelsetrec.html#a88d5ff2e478d1f0aabb391ef91a53df2">setXh3</a>(-2.0 * s2 * (z23 - z21));
<a name="l00688"></a>00688 
<a name="l00689"></a>00689 <span class="comment">//#include &quot;debug2.cpp&quot;</span>
<a name="l00690"></a>00690 }  <span class="comment">// end dscom</span>
<a name="l00691"></a>00691 
<a name="l00703"></a>00703 <span class="keywordtype">void</span> Sgp4unit::dspace
<a name="l00704"></a>00704         <span class="comment">/*</span>
<a name="l00705"></a>00705 <span class="comment">         *</span>
<a name="l00706"></a>00706 <span class="comment">               satrec-&gt;d2201, satrec-&gt;d2211, satrec-&gt;d3210,</span>
<a name="l00707"></a>00707 <span class="comment">               satrec-&gt;d3222, satrec-&gt;d4410, satrec-&gt;d4422,</span>
<a name="l00708"></a>00708 <span class="comment">               satrec-&gt;d5220, satrec-&gt;d5232, satrec-&gt;d5421,</span>
<a name="l00709"></a>00709 <span class="comment">               satrec-&gt;d5433, satrec-&gt;dedt,  satrec-&gt;del1,</span>
<a name="l00710"></a>00710 <span class="comment">               satrec-&gt;del2,  satrec-&gt;del3,  satrec-&gt;didt,</span>
<a name="l00711"></a>00711 <span class="comment">               satrec-&gt;dmdt,  satrec-&gt;dnodt, satrec-&gt;domdt,</span>
<a name="l00712"></a>00712 <span class="comment">               satrec-&gt;argpo, satrec-&gt;argpdot, satrec-&gt;t, tc,</span>
<a name="l00713"></a>00713 <span class="comment">               satrec-&gt;gsto, satrec-&gt;xfact, satrec-&gt;xlamo,</span>
<a name="l00714"></a>00714 <span class="comment">               satrec-&gt;no, satrec-&gt;atime,</span>
<a name="l00715"></a>00715 <span class="comment">               em, argpm, inclm, satrec-&gt;xli, mm, satrec-&gt;xni,</span>
<a name="l00716"></a>00716 <span class="comment">               nodem, dndt, nm</span>
<a name="l00717"></a>00717 <span class="comment">         */</span>
<a name="l00718"></a>00718      (
<a name="l00719"></a>00719 
<a name="l00720"></a>00720                         <span class="keywordtype">double</span> tc,
<a name="l00721"></a>00721                         <span class="keywordtype">double</span>&amp; em,    <span class="keywordtype">double</span>&amp; argpm,  <span class="keywordtype">double</span>&amp; inclm,
<a name="l00722"></a>00722                         <span class="keywordtype">double</span>&amp; mm,    <span class="keywordtype">double</span>&amp; nodem,  <span class="keywordtype">double</span>&amp; dndt,  <span class="keywordtype">double</span>&amp; nm
<a name="l00723"></a>00723      )
<a name="l00724"></a>00724 {
<a name="l00725"></a>00725      <span class="keyword">const</span> <span class="keywordtype">double</span> twopi = 2.0 * <a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>;
<a name="l00726"></a>00726      <span class="keywordtype">int</span> iretn , iret;
<a name="l00727"></a>00727      <span class="keywordtype">double</span> delt, ft, theta, x2li, x2omi, xl, xldot , xnddt, xndt, xomi, g22, g32,
<a name="l00728"></a>00728           g44, g52, g54, fasx2, fasx4, fasx6, rptim , step2, stepn , stepp;
<a name="l00729"></a>00729 
<a name="l00730"></a>00730      fasx2 = 0.13130908;
<a name="l00731"></a>00731      fasx4 = 2.8843198;
<a name="l00732"></a>00732      fasx6 = 0.37448087;
<a name="l00733"></a>00733      g22   = 5.7686396;
<a name="l00734"></a>00734      g32   = 0.95240898;
<a name="l00735"></a>00735      g44   = 1.8014998;
<a name="l00736"></a>00736      g52   = 1.0508330;
<a name="l00737"></a>00737      g54   = 4.4108898;
<a name="l00738"></a>00738      rptim = 4.37526908801129966e-3; <span class="comment">// this equates to 7.29211514668855e-5 rad/sec</span>
<a name="l00739"></a>00739      stepp =    720.0;
<a name="l00740"></a>00740      stepn =   -720.0;
<a name="l00741"></a>00741      step2 = 259200.0;
<a name="l00742"></a>00742 
<a name="l00743"></a>00743      <span class="comment">/* ----------- calculate deep space resonance effects ----------- */</span>
<a name="l00744"></a>00744      dndt   = 0.0;
<a name="l00745"></a>00745      theta  = fmod(satrec-&gt;getGsto() + tc * rptim, twopi);
<a name="l00746"></a>00746      em     = em + satrec-&gt;getDedt() * satrec-&gt;getT();
<a name="l00747"></a>00747 
<a name="l00748"></a>00748      inclm  = inclm + satrec-&gt;getDidt() * satrec-&gt;getT();
<a name="l00749"></a>00749      argpm  = argpm + satrec-&gt;getDomdt() *satrec-&gt;getT();
<a name="l00750"></a>00750      nodem  = nodem + satrec-&gt;getDnodt() * satrec-&gt;getT();
<a name="l00751"></a>00751      mm     = mm + satrec-&gt;getDmdt() * satrec-&gt;getT();
<a name="l00752"></a>00752 
<a name="l00753"></a>00753      <span class="comment">//   sgp4fix for negative inclinations</span>
<a name="l00754"></a>00754      <span class="comment">//   the following if statement should be commented out</span>
<a name="l00755"></a>00755      <span class="comment">//  if (inclm &lt; 0.0)</span>
<a name="l00756"></a>00756      <span class="comment">// {</span>
<a name="l00757"></a>00757      <span class="comment">//    inclm = -inclm;</span>
<a name="l00758"></a>00758      <span class="comment">//    argpm = argpm - pi;</span>
<a name="l00759"></a>00759      <span class="comment">//    nodem = nodem + pi;</span>
<a name="l00760"></a>00760      <span class="comment">//  }</span>
<a name="l00761"></a>00761 
<a name="l00762"></a>00762      <span class="comment">/* - update resonances : numerical (euler-maclaurin) integration - */</span>
<a name="l00763"></a>00763      <span class="comment">/* ------------------------- epoch restart ----------------------  */</span>
<a name="l00764"></a>00764      <span class="comment">//   sgp4fix for propagator problems</span>
<a name="l00765"></a>00765      <span class="comment">//   the following integration works for negative time steps and periods</span>
<a name="l00766"></a>00766      <span class="comment">//   the specific changes are unknown because the original code was so convoluted</span>
<a name="l00767"></a>00767 
<a name="l00768"></a>00768      <span class="comment">// sgp4fix take out atime = 0.0 and fix for faster operation</span>
<a name="l00769"></a>00769      ft    = 0.0;
<a name="l00770"></a>00770      <span class="keywordflow">if</span> (satrec-&gt;getIrez() != 0)
<a name="l00771"></a>00771        {
<a name="l00772"></a>00772          <span class="comment">// sgp4fix streamline check</span>
<a name="l00773"></a>00773          <span class="keywordflow">if</span> ((satrec-&gt;getAtime() == 0.0) || (satrec-&gt;getT() * satrec-&gt;getAtime() &lt;= 0.0) || (fabs(satrec-&gt;getT()) &lt; fabs(satrec-&gt;getAtime())) )
<a name="l00774"></a>00774            {
<a name="l00775"></a>00775                  satrec-&gt;setAtime(0.0);
<a name="l00776"></a>00776                  satrec-&gt;setXni(satrec-&gt;getNo());
<a name="l00777"></a>00777                  satrec-&gt;setXli(satrec-&gt;getXlamo());
<a name="l00778"></a>00778            }
<a name="l00779"></a>00779            <span class="comment">// sgp4fix move check outside loop</span>
<a name="l00780"></a>00780            <span class="keywordflow">if</span> (satrec-&gt;getT() &gt; 0.0)
<a name="l00781"></a>00781                delt = stepp;
<a name="l00782"></a>00782              <span class="keywordflow">else</span>
<a name="l00783"></a>00783                delt = stepn;
<a name="l00784"></a>00784 
<a name="l00785"></a>00785          iretn = 381; <span class="comment">// added for do loop</span>
<a name="l00786"></a>00786          iret  =   0; <span class="comment">// added for loop</span>
<a name="l00787"></a>00787          <span class="keywordflow">while</span> (iretn == 381)
<a name="l00788"></a>00788            {
<a name="l00789"></a>00789              <span class="comment">/* ------------------- dot terms calculated ------------- */</span>
<a name="l00790"></a>00790              <span class="comment">/* ----------- near - synchronous resonance terms ------- */</span>
<a name="l00791"></a>00791              <span class="keywordflow">if</span> (satrec-&gt;getIrez() != 2)
<a name="l00792"></a>00792                {
<a name="l00793"></a>00793                  xndt  = satrec-&gt;getDel1() * sin(satrec-&gt;getXli() - fasx2) + satrec-&gt;getDel2() * sin(2.0 * (satrec-&gt;getXli() - fasx4)) +
<a name="l00794"></a>00794                                  satrec-&gt;getDel3() * sin(3.0 * (satrec-&gt;getXli() - fasx6));
<a name="l00795"></a>00795                  xldot = satrec-&gt;getXni() + satrec-&gt;getXfact();
<a name="l00796"></a>00796                  xnddt = satrec-&gt;getDel1() * cos(satrec-&gt;getXli() - fasx2) +
<a name="l00797"></a>00797                          2.0 * satrec-&gt;getDel2() * cos(2.0 * (satrec-&gt;getXli() - fasx4)) +
<a name="l00798"></a>00798                          3.0 * satrec-&gt;getDel3() * cos(3.0 * (satrec-&gt;getXli() - fasx6));
<a name="l00799"></a>00799                  xnddt = xnddt * xldot;
<a name="l00800"></a>00800                }
<a name="l00801"></a>00801                <span class="keywordflow">else</span>
<a name="l00802"></a>00802                {
<a name="l00803"></a>00803                  <span class="comment">/* --------- near - half-day resonance terms -------- */</span>
<a name="l00804"></a>00804                  xomi  = satrec-&gt;getArgpo() + satrec-&gt;getArgpdot() * satrec-&gt;getAtime();
<a name="l00805"></a>00805                  x2omi = xomi + xomi;
<a name="l00806"></a>00806                  x2li  = satrec-&gt;getXli() + satrec-&gt;getXli();
<a name="l00807"></a>00807                  xndt  = satrec-&gt;getD2201() * sin(x2omi + satrec-&gt;getXli() - g22) + satrec-&gt;getD2211() * sin(satrec-&gt;getXli() - g22) +
<a name="l00808"></a>00808                        satrec-&gt;getD3210() * sin(xomi + satrec-&gt;getXli() - g32)  + satrec-&gt;getD3222() * sin(-xomi + satrec-&gt;getXli() - g32)+
<a name="l00809"></a>00809                        satrec-&gt;getD4410() * sin(x2omi + x2li - g44)+ satrec-&gt;getD4422() * sin(x2li - g44) +
<a name="l00810"></a>00810                        satrec-&gt;getD5220() * sin(xomi + satrec-&gt;getXli() - g52)  + satrec-&gt;getD5232() * sin(-xomi + satrec-&gt;getXli() - g52)+
<a name="l00811"></a>00811                        satrec-&gt;getD5421() * sin(xomi + x2li - g54) + satrec-&gt;getD5433() * sin(-xomi + x2li - g54);
<a name="l00812"></a>00812                  xldot = satrec-&gt;getXni() + satrec-&gt;getXfact();
<a name="l00813"></a>00813                  xnddt = satrec-&gt;getD2201() * cos(x2omi + satrec-&gt;getXli() - g22) + satrec-&gt;getD2211() * cos(satrec-&gt;getXli() - g22) +
<a name="l00814"></a>00814                        satrec-&gt;getD3210() * cos(xomi + satrec-&gt;getXli() - g32) + satrec-&gt;getD3222() * cos(-xomi + satrec-&gt;getXli() - g32) +
<a name="l00815"></a>00815                        satrec-&gt;getD5220() * cos(xomi + satrec-&gt;getXli() - g52) + satrec-&gt;getD5232() * cos(-xomi + satrec-&gt;getXli() - g52) +
<a name="l00816"></a>00816                        2.0 * (satrec-&gt;getD4410() * cos(x2omi + x2li - g44) +
<a name="l00817"></a>00817                        satrec-&gt;getD4422() * cos(x2li - g44) + satrec-&gt;getD5421() * cos(xomi + x2li - g54) +
<a name="l00818"></a>00818                        satrec-&gt;getD5433() * cos(-xomi + x2li - g54));
<a name="l00819"></a>00819                  xnddt = xnddt * xldot;
<a name="l00820"></a>00820                }
<a name="l00821"></a>00821 
<a name="l00822"></a>00822              <span class="comment">/* ----------------------- integrator ------------------- */</span>
<a name="l00823"></a>00823              <span class="comment">// sgp4fix move end checks to end of routine</span>
<a name="l00824"></a>00824              <span class="keywordflow">if</span> (fabs(satrec-&gt;getT() - satrec-&gt;getAtime()) &gt;= stepp)
<a name="l00825"></a>00825                {
<a name="l00826"></a>00826                  iret  = 0;
<a name="l00827"></a>00827                  iretn = 381;
<a name="l00828"></a>00828                }
<a name="l00829"></a>00829                <span class="keywordflow">else</span> <span class="comment">// exit here</span>
<a name="l00830"></a>00830                {
<a name="l00831"></a>00831                  ft    = satrec-&gt;getT() - satrec-&gt;getAtime();
<a name="l00832"></a>00832                  iretn = 0;
<a name="l00833"></a>00833                }
<a name="l00834"></a>00834 
<a name="l00835"></a>00835              <span class="keywordflow">if</span> (iretn == 381)
<a name="l00836"></a>00836                {
<a name="l00837"></a>00837                  satrec-&gt;setXli(satrec-&gt;getXli() + xldot * delt + xndt * step2);
<a name="l00838"></a>00838                  satrec-&gt;setXni(satrec-&gt;getXni() + xndt * delt + xnddt * step2);
<a name="l00839"></a>00839                  satrec-&gt;setAtime(satrec-&gt;getAtime() + delt);
<a name="l00840"></a>00840                }
<a name="l00841"></a>00841            }  <span class="comment">// while iretn = 381</span>
<a name="l00842"></a>00842 
<a name="l00843"></a>00843          nm = satrec-&gt;getXni() + xndt * ft + xnddt * ft * ft * 0.5;
<a name="l00844"></a>00844          xl = satrec-&gt;getXli() + xldot * ft + xndt * ft * ft * 0.5;
<a name="l00845"></a>00845          <span class="keywordflow">if</span> (satrec-&gt;getIrez() != 1)
<a name="l00846"></a>00846            {
<a name="l00847"></a>00847              mm   = xl - 2.0 * nodem + 2.0 * theta;
<a name="l00848"></a>00848              dndt = nm - satrec-&gt;getNo();
<a name="l00849"></a>00849            }
<a name="l00850"></a>00850            <span class="keywordflow">else</span>
<a name="l00851"></a>00851            {
<a name="l00852"></a>00852              mm   = xl - nodem - argpm + theta;
<a name="l00853"></a>00853              dndt = nm - satrec-&gt;getNo();
<a name="l00854"></a>00854            }
<a name="l00855"></a>00855          nm = satrec-&gt;getNo() + dndt;
<a name="l00856"></a>00856        }
<a name="l00857"></a>00857 
<a name="l00858"></a>00858 <span class="comment">//#include &quot;debug4.cpp&quot;</span>
<a name="l00859"></a>00859 }  <span class="comment">// end dsspace</span>
<a name="l00860"></a>00860 
<a name="l00861"></a>00861 <span class="comment">/*-----------------------------------------------------------------------------</span>
<a name="l00862"></a>00862 <span class="comment">*</span>
<a name="l00863"></a>00863 <span class="comment">*                           procedure initl</span>
<a name="l00864"></a>00864 <span class="comment">*</span>
<a name="l00865"></a>00865 <span class="comment">*  this procedure initializes the spg4 propagator. all the initialization is</span>
<a name="l00866"></a>00866 <span class="comment">*    consolidated here instead of having multiple loops inside other routines.</span>
<a name="l00867"></a>00867 <span class="comment">*</span>
<a name="l00868"></a>00868 <span class="comment">*  author        : david vallado                  719-573-2600   28 jun 2005</span>
<a name="l00869"></a>00869 <span class="comment">*</span>
<a name="l00870"></a>00870 <span class="comment">*  inputs        :</span>
<a name="l00871"></a>00871 <span class="comment">*    ecco        - eccentricity                           0.0 - 1.0</span>
<a name="l00872"></a>00872 <span class="comment">*    epoch       - epoch time in days from jan 0, 1950. 0 hr</span>
<a name="l00873"></a>00873 <span class="comment">*    inclo       - inclination of satellite</span>
<a name="l00874"></a>00874 <span class="comment">*    no          - mean motion of satellite</span>
<a name="l00875"></a>00875 <span class="comment">*    satn        - satellite number</span>
<a name="l00876"></a>00876 <span class="comment">*</span>
<a name="l00877"></a>00877 <span class="comment">*  outputs       :</span>
<a name="l00878"></a>00878 <span class="comment">*    ainv        - 1.0 / a</span>
<a name="l00879"></a>00879 <span class="comment">*    ao          - semi major axis</span>
<a name="l00880"></a>00880 <span class="comment">*    con41       -</span>
<a name="l00881"></a>00881 <span class="comment">*    con42       - 1.0 - 5.0 cos(i)</span>
<a name="l00882"></a>00882 <span class="comment">*    cosio       - cosine of inclination</span>
<a name="l00883"></a>00883 <span class="comment">*    cosio2      - cosio squared</span>
<a name="l00884"></a>00884 <span class="comment">*    eccsq       - eccentricity squared</span>
<a name="l00885"></a>00885 <span class="comment">*    method      - flag for deep space                    &#39;d&#39;, &#39;n&#39;</span>
<a name="l00886"></a>00886 <span class="comment">*    omeosq      - 1.0 - ecco * ecco</span>
<a name="l00887"></a>00887 <span class="comment">*    posq        - semi-parameter squared</span>
<a name="l00888"></a>00888 <span class="comment">*    rp          - radius of perigee</span>
<a name="l00889"></a>00889 <span class="comment">*    rteosq      - square root of (1.0 - ecco*ecco)</span>
<a name="l00890"></a>00890 <span class="comment">*    sinio       - sine of inclination</span>
<a name="l00891"></a>00891 <span class="comment">*    gsto        - gst at time of observation               rad</span>
<a name="l00892"></a>00892 <span class="comment">*    no          - mean motion of satellite</span>
<a name="l00893"></a>00893 <span class="comment">*</span>
<a name="l00894"></a>00894 <span class="comment">*  locals        :</span>
<a name="l00895"></a>00895 <span class="comment">*    ak          -</span>
<a name="l00896"></a>00896 <span class="comment">*    d1          -</span>
<a name="l00897"></a>00897 <span class="comment">*    del         -</span>
<a name="l00898"></a>00898 <span class="comment">*    adel        -</span>
<a name="l00899"></a>00899 <span class="comment">*    po          -</span>
<a name="l00900"></a>00900 <span class="comment">*</span>
<a name="l00901"></a>00901 <span class="comment">*  coupling      :</span>
<a name="l00902"></a>00902 <span class="comment">*    getgravconst</span>
<a name="l00903"></a>00903 <span class="comment">*    gstime      - find greenwich sidereal time from the julian date</span>
<a name="l00904"></a>00904 <span class="comment">*</span>
<a name="l00905"></a>00905 <span class="comment">*  references    :</span>
<a name="l00906"></a>00906 <span class="comment">*    hoots, roehrich, norad spacetrack report #3 1980</span>
<a name="l00907"></a>00907 <span class="comment">*    hoots, norad spacetrack report #6 1986</span>
<a name="l00908"></a>00908 <span class="comment">*    hoots, schumacher and glover 2004</span>
<a name="l00909"></a>00909 <span class="comment">*    vallado, crawford, hujsak, kelso  2006</span>
<a name="l00910"></a>00910 <span class="comment">  ----------------------------------------------------------------------------*/</span>
<a name="l00911"></a>00911 
<a name="l00929"></a>00929 <span class="keywordtype">void</span> Sgp4unit::initl
<a name="l00930"></a>00930      (
<a name="l00931"></a>00931        <span class="keywordtype">int</span> satn,      <a class="code" href="gravconsttype_8h.html#a8b910c09824c4a9d8365e717c31dda5e">gravconsttype</a> whichconst,
<a name="l00932"></a>00932        <span class="keywordtype">double</span> epoch,
<a name="l00933"></a>00933        <span class="keywordtype">double</span>&amp; ainv,  <span class="keywordtype">double</span>&amp; ao,  <span class="keywordtype">double</span>&amp; con42, <span class="keywordtype">double</span>&amp; cosio,
<a name="l00934"></a>00934        <span class="keywordtype">double</span>&amp; cosio2,<span class="keywordtype">double</span>&amp; eccsq, <span class="keywordtype">double</span>&amp; omeosq, <span class="keywordtype">double</span>&amp; posq,
<a name="l00935"></a>00935        <span class="keywordtype">double</span>&amp; rp,    <span class="keywordtype">double</span>&amp; rteosq,<span class="keywordtype">double</span>&amp; sinio)
<a name="l00936"></a>00936 {
<a name="l00937"></a>00937      <span class="comment">/* --------------------- local variables ------------------------ */</span>
<a name="l00938"></a>00938      <span class="keywordtype">double</span> ak, d1, del, adel, po, x2o3, j2, xke,
<a name="l00939"></a>00939             tumin, mu, radiusearthkm, j3, j4, j3oj2;
<a name="l00940"></a>00940 
<a name="l00941"></a>00941      <span class="comment">// sgp4fix use old way of finding gst</span>
<a name="l00942"></a>00942      <span class="keywordtype">double</span> ds70;
<a name="l00943"></a>00943      <span class="keywordtype">double</span> ts70, tfrac, c1, thgr70, fk5r, c1p2p;<span class="comment">//, thgr, thgro;</span>
<a name="l00944"></a>00944      <span class="keyword">const</span> <span class="keywordtype">double</span> twopi = 2.0 * <a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>;
<a name="l00945"></a>00945 
<a name="l00946"></a>00946      <span class="comment">/* ----------------------- earth constants ---------------------- */</span>
<a name="l00947"></a>00947      <span class="comment">// sgp4fix identify constants and allow alternate values</span>
<a name="l00948"></a>00948      <a class="code" href="gravconsttype_8cpp.html#ad4600d22fe78cc71f195a7c50ed92f3b" title="Esta función se utiliza para obtener el conjunto de valores dependiendo de la constante...">getgravconst</a>( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
<a name="l00949"></a>00949      x2o3   = 2.0 / 3.0;
<a name="l00950"></a>00950 
<a name="l00951"></a>00951      <span class="comment">/* ------------- calculate auxillary epoch quantities ---------- */</span>
<a name="l00952"></a>00952      eccsq  = satrec-&gt;<a class="code" href="classelsetrec.html#a6ae438d068b3152b1a706b246995092e">getEcco</a>() * satrec-&gt;<a class="code" href="classelsetrec.html#a6ae438d068b3152b1a706b246995092e">getEcco</a>();
<a name="l00953"></a>00953      omeosq = 1.0 - eccsq;
<a name="l00954"></a>00954      rteosq = sqrt(omeosq);
<a name="l00955"></a>00955      cosio  = cos(satrec-&gt;<a class="code" href="classelsetrec.html#a94e0da477d5ada44187d768d6373144d">getInclo</a>());
<a name="l00956"></a>00956      cosio2 = cosio * cosio;
<a name="l00957"></a>00957 
<a name="l00958"></a>00958      <span class="comment">/* ------------------ un-kozai the mean motion ----------------- */</span>
<a name="l00959"></a>00959 
<a name="l00960"></a>00960      ak    = pow(xke / satrec-&gt;<a class="code" href="classelsetrec.html#a9d35bbf23b765047af74635f402f95d0">getNo</a>(), x2o3);
<a name="l00961"></a>00961      d1    = 0.75 * j2 * (3.0 * cosio2 - 1.0) / (rteosq * omeosq);
<a name="l00962"></a>00962      del   = d1 / (ak * ak);
<a name="l00963"></a>00963      adel  = ak * (1.0 - del * del - del *
<a name="l00964"></a>00964              (1.0 / 3.0 + 134.0 * del * del / 81.0));
<a name="l00965"></a>00965      del   = d1/(adel * adel);
<a name="l00966"></a>00966      satrec-&gt;<a class="code" href="classelsetrec.html#aaed8e64890844a64c8f2d260bee471c2">setNo</a>(satrec-&gt;<a class="code" href="classelsetrec.html#a9d35bbf23b765047af74635f402f95d0">getNo</a>() / (1.0 + del));
<a name="l00967"></a>00967 
<a name="l00968"></a>00968      ao    = pow(xke / satrec-&gt;<a class="code" href="classelsetrec.html#a9d35bbf23b765047af74635f402f95d0">getNo</a>(), x2o3);
<a name="l00969"></a>00969      sinio = sin(satrec-&gt;<a class="code" href="classelsetrec.html#a94e0da477d5ada44187d768d6373144d">getInclo</a>());
<a name="l00970"></a>00970      po    = ao * omeosq;
<a name="l00971"></a>00971      con42 = 1.0 - 5.0 * cosio2;
<a name="l00972"></a>00972      satrec-&gt;<a class="code" href="classelsetrec.html#ad085dcdb5416498bf05d288aff3fa052">setCon41</a>(-con42-cosio2-cosio2);
<a name="l00973"></a>00973      ainv  = 1.0 / ao;
<a name="l00974"></a>00974      posq  = po * po;
<a name="l00975"></a>00975      rp    = ao * (1.0 - satrec-&gt;<a class="code" href="classelsetrec.html#a6ae438d068b3152b1a706b246995092e">getEcco</a>());
<a name="l00976"></a>00976      satrec-&gt;<a class="code" href="classelsetrec.html#a75073aead83e8ea56853e218ce2928b9">setMethod</a>(<span class="charliteral">&#39;n&#39;</span>);
<a name="l00977"></a>00977 
<a name="l00978"></a>00978      <span class="comment">// sgp4fix modern approach to finding sidereal time</span>
<a name="l00979"></a>00979      <span class="keywordflow">if</span> (satrec-&gt;<a class="code" href="classelsetrec.html#a723fcbade6a8ddc7be174d7d89dc0fc8">getOperationmode</a>() == <span class="charliteral">&#39;a&#39;</span>)
<a name="l00980"></a>00980         {
<a name="l00981"></a>00981          <span class="comment">// sgp4fix use old way of finding gst</span>
<a name="l00982"></a>00982          <span class="comment">// count integer number of days from 0 jan 1970</span>
<a name="l00983"></a>00983          ts70  = epoch - 7305.0;
<a name="l00984"></a>00984          ds70 = floor(ts70 + 1.0e-8);
<a name="l00985"></a>00985          tfrac = ts70 - ds70;
<a name="l00986"></a>00986          <span class="comment">// find greenwich location at epoch</span>
<a name="l00987"></a>00987          c1    = 1.72027916940703639e-2;
<a name="l00988"></a>00988          thgr70= 1.7321343856509374;
<a name="l00989"></a>00989          fk5r  = 5.07551419432269442e-15;
<a name="l00990"></a>00990          c1p2p = c1 + twopi;
<a name="l00991"></a>00991          satrec-&gt;<a class="code" href="classelsetrec.html#a7f0dac7c3a0e52afaa71f161de1884b5">setGsto</a>(fmod( thgr70 + c1*ds70 + c1p2p*tfrac + ts70*ts70*fk5r, twopi));
<a name="l00992"></a>00992          <span class="keywordflow">if</span> ( satrec-&gt;<a class="code" href="classelsetrec.html#aee34e33b848b20c139348575e3da4b87">getGsto</a>() &lt; 0.0 )
<a name="l00993"></a>00993                  satrec-&gt;<a class="code" href="classelsetrec.html#a7f0dac7c3a0e52afaa71f161de1884b5">setGsto</a>(satrec-&gt;<a class="code" href="classelsetrec.html#aee34e33b848b20c139348575e3da4b87">getGsto</a>() + twopi);
<a name="l00994"></a>00994        }
<a name="l00995"></a>00995        <span class="keywordflow">else</span>
<a name="l00996"></a>00996 
<a name="l00997"></a>00997            satrec-&gt;<a class="code" href="classelsetrec.html#a7f0dac7c3a0e52afaa71f161de1884b5">setGsto</a>(<a class="code" href="classsgp4__date.html#a9f5ce9d110c4cbadb06c9bfeaef28e91" title="Esta función devuelve la posición angular del tiempo sidéreo de Greenwich a través...">sgp4_date::gstime</a>(epoch + 2433281.5));
<a name="l00998"></a>00998 
<a name="l00999"></a>00999 
<a name="l01000"></a>01000 <span class="comment">//#include &quot;debug5.cpp&quot;</span>
<a name="l01001"></a>01001 }  <span class="comment">// end initl</span>
<a name="l01002"></a>01002 
<a name="l01009"></a>01009 <span class="keywordtype">bool</span> <a class="code" href="class_sgp4unit.html#ad084f0a30db5884099f45453ff92c05a" title="Inicializa las variables del sistema sgp4.">Sgp4unit::sgp4init</a>
<a name="l01010"></a><a class="code" href="class_sgp4unit.html#ad084f0a30db5884099f45453ff92c05a">01010</a>      (
<a name="l01011"></a>01011        <a class="code" href="gravconsttype_8h.html#a8b910c09824c4a9d8365e717c31dda5e">gravconsttype</a> whichconst, <span class="keywordtype">char</span> opsmode
<a name="l01012"></a>01012      )
<a name="l01013"></a>01013 {
<a name="l01014"></a>01014      <span class="comment">/* --------------------- local variables ------------------------ */</span>
<a name="l01015"></a>01015      <span class="keywordtype">double</span> ao, ainv,   con42, cosio, sinio, cosio2, eccsq,
<a name="l01016"></a>01016           omeosq, posq,   rp,     rteosq,
<a name="l01017"></a>01017           cnodm , snodm , cosim , sinim , cosomm, sinomm, cc1sq ,
<a name="l01018"></a>01018           cc2   , cc3   , coef  , coef1 , cosio4, day   , dndt  ,
<a name="l01019"></a>01019           em    , emsq  , eeta  , etasq , gam   , argpm , nodem ,
<a name="l01020"></a>01020           inclm , mm    , nm    , perige, pinvsq, psisq , qzms24,
<a name="l01021"></a>01021           rtemsq, s1    , s2    , s3    , s4    , s5    , s6    ,
<a name="l01022"></a>01022           s7    , sfour , ss1   , ss2   , ss3   , ss4   , ss5   ,
<a name="l01023"></a>01023           ss6   , ss7   , sz1   , sz2   , sz3   , sz11  , sz12  ,
<a name="l01024"></a>01024           sz13  , sz21  , sz22  , sz23  , sz31  , sz32  , sz33  ,
<a name="l01025"></a>01025           tc    , temp  , temp1 , temp2 , temp3 , tsi   , xpidot,
<a name="l01026"></a>01026           xhdot1, z1    , z2    , z3    , z11   , z12   , z13   ,
<a name="l01027"></a>01027           z21   , z22   , z23   , z31   , z32   , z33,
<a name="l01028"></a>01028           qzms2t, ss, j2, j3oj2, j4, x2o3, r[3], v[3],
<a name="l01029"></a>01029           tumin, mu, radiusearthkm, xke, j3;
<a name="l01030"></a>01030 
<a name="l01031"></a>01031      <span class="comment">/* ------------------------ initialization --------------------- */</span>
<a name="l01032"></a>01032      <span class="comment">// sgp4fix divisor for divide by zero check on inclination</span>
<a name="l01033"></a>01033      <span class="comment">// the old check used 1.0 + cos(pi-1.0e-9), but then compared it to</span>
<a name="l01034"></a>01034      <span class="comment">// 1.5 e-12, so the threshold was changed to 1.5e-12 for consistency</span>
<a name="l01035"></a>01035      <span class="keyword">const</span> <span class="keywordtype">double</span> temp4    =   1.5e-12;
<a name="l01036"></a>01036      <span class="keyword">const</span> <span class="keywordtype">int</span> satn = satrec-&gt;getSatnum();
<a name="l01037"></a>01037      <span class="keyword">const</span> <span class="keywordtype">double</span> epoch =satrec-&gt;getJdsatepoch()-2433281.5;
<a name="l01038"></a>01038 
<a name="l01039"></a>01039      <span class="comment">/* ----------- set all near earth variables to zero ------------ */</span>
<a name="l01040"></a>01040 
<a name="l01041"></a>01041      <span class="comment">// sgp4fix - note the following variables are also passed directly via satrec-&gt;</span>
<a name="l01042"></a>01042      <span class="comment">// it is possible to streamline the sgp4init call by deleting the &quot;x&quot;</span>
<a name="l01043"></a>01043      <span class="comment">// variables, but the user would need to set the satrec-&gt;* values first. we</span>
<a name="l01044"></a>01044      <span class="comment">// include the additional assignments in case twoline2rv is not used.</span>
<a name="l01045"></a>01045 
<a name="l01046"></a>01046 
<a name="l01047"></a>01047      <span class="comment">// sgp4fix add opsmode</span>
<a name="l01048"></a>01048      satrec-&gt;setOperationmode(opsmode);
<a name="l01049"></a>01049 
<a name="l01050"></a>01050      <span class="comment">/* ------------------------ earth constants ----------------------- */</span>
<a name="l01051"></a>01051      <span class="comment">// sgp4fix identify constants and allow alternate values</span>
<a name="l01052"></a>01052      <a class="code" href="gravconsttype_8cpp.html#ad4600d22fe78cc71f195a7c50ed92f3b" title="Esta función se utiliza para obtener el conjunto de valores dependiendo de la constante...">getgravconst</a>( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
<a name="l01053"></a>01053      ss     = 78.0 / radiusearthkm + 1.0;
<a name="l01054"></a>01054      qzms2t = pow(((120.0 - 78.0) / radiusearthkm), 4);
<a name="l01055"></a>01055      x2o3   =  2.0 / 3.0;
<a name="l01056"></a>01056 
<a name="l01057"></a>01057      satrec-&gt;setInit(<span class="charliteral">&#39;y&#39;</span>);
<a name="l01058"></a>01058      satrec-&gt;setT(0.0);
<a name="l01059"></a>01059      <span class="comment">/*</span>
<a name="l01060"></a>01060 <span class="comment">      * void Sgp4unit::initl</span>
<a name="l01061"></a>01061 <span class="comment">     (</span>
<a name="l01062"></a>01062 <span class="comment">       int satn,      gravconsttype whichconst,</span>
<a name="l01063"></a>01063 <span class="comment">       double ecco,   double epoch,  double inclo,   double&amp; no,</span>
<a name="l01064"></a>01064 <span class="comment">       char&amp; method,</span>
<a name="l01065"></a>01065 <span class="comment">       double&amp; ainv,  double&amp; ao,    double&amp; con41,  double&amp; con42, double&amp; cosio,</span>
<a name="l01066"></a>01066 <span class="comment">       double&amp; cosio2,double&amp; eccsq, double&amp; omeosq, double&amp; posq,</span>
<a name="l01067"></a>01067 <span class="comment">       double&amp; rp,    double&amp; rteosq,double&amp; sinio , double&amp; gsto,</span>
<a name="l01068"></a>01068 <span class="comment">       char opsmode</span>
<a name="l01069"></a>01069 <span class="comment">     )</span>
<a name="l01070"></a>01070 <span class="comment">      *</span>
<a name="l01071"></a>01071 <span class="comment">      */</span>
<a name="l01072"></a>01072      initl
<a name="l01073"></a>01073          (
<a name="l01074"></a>01074            satn, whichconst, epoch,
<a name="l01075"></a>01075            ainv, ao, con42, cosio, cosio2, eccsq, omeosq,
<a name="l01076"></a>01076            posq, rp, rteosq, sinio
<a name="l01077"></a>01077          );
<a name="l01078"></a>01078      satrec-&gt;setError(0);
<a name="l01079"></a>01079 
<a name="l01080"></a>01080      <span class="comment">// sgp4fix remove this check as it is unnecessary</span>
<a name="l01081"></a>01081      <span class="comment">// the mrt check in sgp4 handles decaying satellite cases even if the starting</span>
<a name="l01082"></a>01082      <span class="comment">// condition is below the surface of te earth</span>
<a name="l01083"></a>01083 <span class="comment">//     if (rp &lt; 1.0)</span>
<a name="l01084"></a>01084 <span class="comment">//       {</span>
<a name="l01085"></a>01085 <span class="comment">//         printf(&quot;# *** satn%d epoch elts sub-orbital ***\n&quot;, satn);</span>
<a name="l01086"></a>01086 <span class="comment">//         satrec-&gt;error = 5;</span>
<a name="l01087"></a>01087 <span class="comment">//       }</span>
<a name="l01088"></a>01088 
<a name="l01089"></a>01089      <span class="keywordflow">if</span> ((omeosq &gt;= 0.0 ) || ( satrec-&gt;getNo() &gt;= 0.0))
<a name="l01090"></a>01090        {
<a name="l01091"></a>01091          satrec-&gt;setIsimp(0);
<a name="l01092"></a>01092          <span class="keywordflow">if</span> (rp &lt; (220.0 / radiusearthkm + 1.0))
<a name="l01093"></a>01093                  satrec-&gt;setIsimp(1);
<a name="l01094"></a>01094          sfour  = ss;
<a name="l01095"></a>01095          qzms24 = qzms2t;
<a name="l01096"></a>01096          perige = (rp - 1.0) * radiusearthkm;
<a name="l01097"></a>01097 
<a name="l01098"></a>01098          <span class="comment">/* - for perigees below 156 km, s and qoms2t are altered - */</span>
<a name="l01099"></a>01099          <span class="keywordflow">if</span> (perige &lt; 156.0)
<a name="l01100"></a>01100            {
<a name="l01101"></a>01101              sfour = perige - 78.0;
<a name="l01102"></a>01102              <span class="keywordflow">if</span> (perige &lt; 98.0)
<a name="l01103"></a>01103                  sfour = 20.0;
<a name="l01104"></a>01104              qzms24 = pow(((120.0 - sfour) / radiusearthkm), 4.0);
<a name="l01105"></a>01105              sfour  = sfour / radiusearthkm + 1.0;
<a name="l01106"></a>01106            }
<a name="l01107"></a>01107          pinvsq = 1.0 / posq;
<a name="l01108"></a>01108 
<a name="l01109"></a>01109          tsi  = 1.0 / (ao - sfour);
<a name="l01110"></a>01110          satrec-&gt;setEta(ao * satrec-&gt;getEcco() * tsi);
<a name="l01111"></a>01111          etasq = satrec-&gt;getEta() * satrec-&gt;getEta();
<a name="l01112"></a>01112          eeta  = satrec-&gt;getEcco() * satrec-&gt;getEta();
<a name="l01113"></a>01113          psisq = fabs(1.0 - etasq);
<a name="l01114"></a>01114          coef  = qzms24 * pow(tsi, 4.0);
<a name="l01115"></a>01115          coef1 = coef / pow(psisq, 3.5);
<a name="l01116"></a>01116          cc2   = coef1 * satrec-&gt;getNo() * (ao * (1.0 + 1.5 * etasq + eeta *
<a name="l01117"></a>01117                         (4.0 + etasq)) + 0.375 * j2 * tsi / psisq * satrec-&gt;getCon41() *
<a name="l01118"></a>01118                         (8.0 + 3.0 * etasq * (8.0 + etasq)));
<a name="l01119"></a>01119          satrec-&gt;setCc1(satrec-&gt;getBstar() * cc2);
<a name="l01120"></a>01120          cc3   = 0.0;
<a name="l01121"></a>01121          <span class="keywordflow">if</span> (satrec-&gt;getEcco() &gt; 1.0e-4)
<a name="l01122"></a>01122              cc3 = -2.0 * coef * tsi * j3oj2 * satrec-&gt;getNo() * sinio / satrec-&gt;getEcco();
<a name="l01123"></a>01123          satrec-&gt;setX1mth2(1.0 - cosio2);
<a name="l01124"></a>01124          satrec-&gt;setCc4(2.0* satrec-&gt;getNo() * coef1 * ao * omeosq * (satrec-&gt;getEta() * (2.0 + 0.5 * etasq) + satrec-&gt;getEcco() *
<a name="l01125"></a>01125                            (0.5 + 2.0 * etasq) - j2 * tsi / (ao * psisq) *
<a name="l01126"></a>01126                            (-3.0 * satrec-&gt;getCon41() * (1.0 - 2.0 * eeta + etasq *
<a name="l01127"></a>01127                            (1.5 - 0.5 * eeta)) + 0.75 * satrec-&gt;getX1mth2() *
<a name="l01128"></a>01128                            (2.0 * etasq - eeta * (1.0 + etasq)) * cos(2.0 * satrec-&gt;getArgpo()))));
<a name="l01129"></a>01129          satrec-&gt;setCc5(2.0 * coef1 * ao * omeosq * (1.0 + 2.75 *
<a name="l01130"></a>01130                         (etasq + eeta) + eeta * etasq));
<a name="l01131"></a>01131          cosio4 = cosio2 * cosio2;
<a name="l01132"></a>01132          temp1  = 1.5 * j2 * pinvsq * satrec-&gt;getNo();
<a name="l01133"></a>01133          temp2  = 0.5 * temp1 * j2 * pinvsq;
<a name="l01134"></a>01134          temp3  = -0.46875 * j4 * pinvsq * pinvsq * satrec-&gt;getNo();
<a name="l01135"></a>01135          satrec-&gt;setMdot (satrec-&gt;getNo() + 0.5 * temp1 * rteosq * satrec-&gt;getCon41() + 0.0625 *
<a name="l01136"></a>01136                             temp2 * rteosq * (13.0 - 78.0 * cosio2 + 137.0 * cosio4));
<a name="l01137"></a>01137          satrec-&gt;setArgpdot(-0.5 * temp1 * con42 + 0.0625 * temp2 *
<a name="l01138"></a>01138                              (7.0 - 114.0 * cosio2 + 395.0 * cosio4) +
<a name="l01139"></a>01139                              temp3 * (3.0 - 36.0 * cosio2 + 49.0 * cosio4));
<a name="l01140"></a>01140          xhdot1            = -temp1 * cosio;
<a name="l01141"></a>01141          satrec-&gt;setNodedot(xhdot1 + (0.5 * temp2 * (4.0 - 19.0 * cosio2) +
<a name="l01142"></a>01142                               2.0 * temp3 * (3.0 - 7.0 * cosio2)) * cosio);
<a name="l01143"></a>01143          xpidot            =  satrec-&gt;getArgpdot()+ satrec-&gt;getNodedot();
<a name="l01144"></a>01144          satrec-&gt;setOmgcof(satrec-&gt;getBstar() * cc3 * cos(satrec-&gt;getArgpo()));
<a name="l01145"></a>01145          satrec-&gt;setXmcof(0.0);
<a name="l01146"></a>01146          <span class="keywordflow">if</span> (satrec-&gt;getEcco() &gt; 1.0e-4)
<a name="l01147"></a>01147              satrec-&gt;setXmcof(-x2o3 * coef * satrec-&gt;getBstar() / eeta);
<a name="l01148"></a>01148          satrec-&gt;setNodecf(3.5 * omeosq * xhdot1 * satrec-&gt;getCc1());
<a name="l01149"></a>01149          satrec-&gt;setT2cof(1.5 * satrec-&gt;getCc1());
<a name="l01150"></a>01150          <span class="comment">// sgp4fix for divide by zero with xinco = 180 deg</span>
<a name="l01151"></a>01151          <span class="keywordflow">if</span> (fabs(cosio+1.0) &gt; 1.5e-12)
<a name="l01152"></a>01152              satrec-&gt;setXlcof(-0.25 * j3oj2 * sinio * (3.0 + 5.0 * cosio) / (1.0 + cosio));
<a name="l01153"></a>01153            <span class="keywordflow">else</span>
<a name="l01154"></a>01154              satrec-&gt;setXlcof(-0.25 * j3oj2 * sinio * (3.0 + 5.0 * cosio) / temp4);
<a name="l01155"></a>01155          satrec-&gt;setAycof(-0.5 * j3oj2 * sinio);
<a name="l01156"></a>01156          satrec-&gt;setDelmo(pow((1.0 + satrec-&gt;getEta() * cos(satrec-&gt;getMo())), 3));
<a name="l01157"></a>01157          satrec-&gt;setSinmao(sin(satrec-&gt;getMo()));
<a name="l01158"></a>01158          satrec-&gt;setX7thm1(7.0 * cosio2 - 1.0);
<a name="l01159"></a>01159 
<a name="l01160"></a>01160          <span class="comment">/* --------------- deep space initialization ------------- */</span>
<a name="l01161"></a>01161          <span class="keywordflow">if</span> ((2*<a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a> / satrec-&gt;getNo()) &gt;= 225.0)
<a name="l01162"></a>01162            {
<a name="l01163"></a>01163              satrec-&gt;setMethod(<span class="charliteral">&#39;d&#39;</span>);
<a name="l01164"></a>01164              satrec-&gt;setIsimp(1);
<a name="l01165"></a>01165              tc    =  0.0;
<a name="l01166"></a>01166              inclm = satrec-&gt;getInclo();
<a name="l01167"></a>01167 
<a name="l01168"></a>01168              dscom(
<a name="l01169"></a>01169              epoch, tc, snodm, cnodm,  sinim, cosim,sinomm,     cosomm,
<a name="l01170"></a>01170                                day,em,         emsq, gam,
<a name="l01171"></a>01171                                rtemsq, s1, s2, s3, s4, s5,
<a name="l01172"></a>01172                                s6,   s7,   ss1,  ss2,  ss3,  ss4,  ss5,  ss6,  ss7, sz1, sz2, sz3,
<a name="l01173"></a>01173                                sz11, sz12, sz13, sz21, sz22, sz23, sz31, sz32, sz33,
<a name="l01174"></a>01174                                nm, z1, z2, z3, z11,
<a name="l01175"></a>01175                                z12, z13, z21, z22, z23, z31, z32, z33);
<a name="l01176"></a>01176              <span class="comment">/*</span>
<a name="l01177"></a>01177 <span class="comment">              * (</span>
<a name="l01178"></a>01178 <span class="comment">       double e3,     double ee2,    double peo,     double pgho,   double pho,</span>
<a name="l01179"></a>01179 <span class="comment">       double pinco,  double plo,    double se2,     double se3,    double sgh2,</span>
<a name="l01180"></a>01180 <span class="comment">       double sgh3,   double sgh4,   double sh2,     double sh3,    double si2,</span>
<a name="l01181"></a>01181 <span class="comment">       double si3,    double sl2,    double sl3,     double sl4,    double t,</span>
<a name="l01182"></a>01182 <span class="comment">       double xgh2,   double xgh3,   double xgh4,    double xh2,    double xh3,</span>
<a name="l01183"></a>01183 <span class="comment">       double xi2,    double xi3,    double xl2,     double xl3,    double xl4,</span>
<a name="l01184"></a>01184 <span class="comment">       double zmol,   double zmos,   double inclo,</span>
<a name="l01185"></a>01185 <span class="comment">       char init,</span>
<a name="l01186"></a>01186 <span class="comment">       double&amp; ep,    double&amp; inclp, double&amp; nodep,  double&amp; argpp, double&amp; mp,</span>
<a name="l01187"></a>01187 <span class="comment">       char opsmode</span>
<a name="l01188"></a>01188 <span class="comment">     )</span>
<a name="l01189"></a>01189 <span class="comment">              */</span>
<a name="l01190"></a>01190              <span class="keywordtype">double</span> ep,iclp,nodep,argpp,mp;
<a name="l01191"></a>01191              ep=satrec-&gt;getEcco();
<a name="l01192"></a>01192              iclp=satrec-&gt;getInclo();
<a name="l01193"></a>01193              nodep=satrec-&gt;getNodeo();
<a name="l01194"></a>01194              argpp=satrec-&gt;getArgpo();
<a name="l01195"></a>01195              mp=satrec-&gt;getMo();
<a name="l01196"></a>01196              dpper
<a name="l01197"></a>01197                               ( inclm, satrec-&gt;getInit(),
<a name="l01198"></a>01198                                           ep,iclp,nodep,argpp,mp
<a name="l01199"></a>01199 
<a name="l01200"></a>01200                               );
<a name="l01201"></a>01201              satrec-&gt;setEcco(ep);
<a name="l01202"></a>01202              satrec-&gt;setInclo(iclp);
<a name="l01203"></a>01203              satrec-&gt;setNodeo(nodep);
<a name="l01204"></a>01204              satrec-&gt;setArgpo(argpp);
<a name="l01205"></a>01205              satrec-&gt;setMo(mp);
<a name="l01206"></a>01206              argpm  = 0.0;
<a name="l01207"></a>01207              nodem  = 0.0;
<a name="l01208"></a>01208              mm     = 0.0;
<a name="l01209"></a>01209 
<a name="l01210"></a>01210              dsinit
<a name="l01211"></a>01211                  (
<a name="l01212"></a>01212                                  whichconst,
<a name="l01213"></a>01213                                 cosim, emsq,s1, s2, s3, s4, s5, sinim, ss1, ss2, ss3, ss4,
<a name="l01214"></a>01214                                 ss5, sz1, sz3, sz11, sz13, sz21, sz23, sz31, sz33, tc,
<a name="l01215"></a>01215                                 xpidot, z1, z3, z11, z13, z21, z23, z31, z33,
<a name="l01216"></a>01216                                 eccsq, em, argpm, inclm, mm, nm, nodem,
<a name="l01217"></a>01217                                 dndt
<a name="l01218"></a>01218                  );
<a name="l01219"></a>01219            }
<a name="l01220"></a>01220 
<a name="l01221"></a>01221        <span class="comment">/* ----------- set variables if not deep space ----------- */</span>
<a name="l01222"></a>01222        <span class="keywordflow">if</span> (satrec-&gt;getIsimp() != 1)
<a name="l01223"></a>01223          {
<a name="l01224"></a>01224            cc1sq          = satrec-&gt;getCc1() * satrec-&gt;getCc1();
<a name="l01225"></a>01225            satrec-&gt;setD2(4.0 * ao * tsi * cc1sq);
<a name="l01226"></a>01226            temp           = satrec-&gt;getD2() * tsi * satrec-&gt;getCc1() / 3.0;
<a name="l01227"></a>01227            satrec-&gt;setD3((17.0 * ao + sfour) * temp);
<a name="l01228"></a>01228            satrec-&gt;setD4(0.5 * temp * ao * tsi * (221.0 * ao + 31.0 * sfour) *
<a name="l01229"></a>01229                             satrec-&gt;getCc1());
<a name="l01230"></a>01230            satrec-&gt;setT3cof(satrec-&gt;getD2() + 2.0 * cc1sq);
<a name="l01231"></a>01231            satrec-&gt;setT4cof(0.25 * (3.0 * satrec-&gt;getD3() + satrec-&gt;getCc1() *
<a name="l01232"></a>01232                             (12.0 * satrec-&gt;getD2() + 10.0 * cc1sq)));
<a name="l01233"></a>01233            satrec-&gt;setT5cof(0.2 * (3.0 * satrec-&gt;getD4() +
<a name="l01234"></a>01234                             12.0 * satrec-&gt;getCc1() * satrec-&gt;getD3() +
<a name="l01235"></a>01235                             6.0 * satrec-&gt;getD2() * satrec-&gt;getD2() +
<a name="l01236"></a>01236                             15.0 * cc1sq * (2.0 * satrec-&gt;getD2() + cc1sq)));
<a name="l01237"></a>01237          }
<a name="l01238"></a>01238        } <span class="comment">// if omeosq = 0 ...</span>
<a name="l01239"></a>01239 
<a name="l01240"></a>01240        <span class="comment">/* finally propogate to zero epoch to initialize all others. */</span>
<a name="l01241"></a>01241        <span class="comment">// sgp4fix take out check to let satellites process until they are actually below earth surface</span>
<a name="l01242"></a>01242 <span class="comment">//       if(satrec-&gt;error == 0)</span>
<a name="l01243"></a>01243        sgp4(whichconst,0.0, r, v);
<a name="l01244"></a>01244 
<a name="l01245"></a>01245        satrec-&gt;setInit(<span class="charliteral">&#39;n&#39;</span>);
<a name="l01246"></a>01246 
<a name="l01247"></a>01247 <span class="comment">//#include &quot;debug6.cpp&quot;</span>
<a name="l01248"></a>01248        <span class="comment">//sgp4fix return boolean. satrec-&gt;error contains any error codes</span>
<a name="l01249"></a>01249        <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l01250"></a>01250 }  <span class="comment">// end sgp</span>
<a name="l01251"></a>01251 
<a name="l01260"></a>01260 <span class="keywordtype">bool</span> <a class="code" href="class_sgp4unit.html#af2778fc2c0f0ebc1f171cf05e6a6eb06">Sgp4unit::sgp4</a>
<a name="l01261"></a><a class="code" href="class_sgp4unit.html#af2778fc2c0f0ebc1f171cf05e6a6eb06">01261</a>      (
<a name="l01262"></a>01262        <a class="code" href="gravconsttype_8h.html#a8b910c09824c4a9d8365e717c31dda5e">gravconsttype</a> whichconst,  <span class="keywordtype">double</span> tsince,
<a name="l01263"></a>01263        <span class="keywordtype">double</span> r[3],  <span class="keywordtype">double</span> v[3]
<a name="l01264"></a>01264      )
<a name="l01265"></a>01265 {
<a name="l01266"></a>01266      <span class="keywordtype">double</span> am   , axnl  , aynl , betal ,  cosim , cnod  ,
<a name="l01267"></a>01267          cos2u, coseo1, cosi , cosip ,  cosisq, cossu , cosu,
<a name="l01268"></a>01268          delm , delomg, em   , emsq  ,  ecose , el2   , eo1 ,
<a name="l01269"></a>01269          ep   , esine , argpm, argpp ,  argpdf, pl,     mrt = 0.0,
<a name="l01270"></a>01270          mvt  , rdotl , rl   , rvdot ,  rvdotl, sinim ,
<a name="l01271"></a>01271          sin2u, sineo1, sini , sinip ,  sinsu , sinu  ,
<a name="l01272"></a>01272          snod , su    , t2   , t3    ,  t4    , tem5  , temp,
<a name="l01273"></a>01273          temp1, temp2 , tempa, tempe ,  templ , u     , ux  ,
<a name="l01274"></a>01274          uy   , uz    , vx   , vy    ,  vz    , inclm , mm  ,
<a name="l01275"></a>01275          nm   , nodem, xinc , xincp ,  xl    , xlm   , mp  ,
<a name="l01276"></a>01276          xmdf , xmx   , xmy  , nodedf, xnode , nodep, tc  , dndt,
<a name="l01277"></a>01277          twopi, x2o3  , j2   , j3    , tumin, j4 , xke   , j3oj2, radiusearthkm,
<a name="l01278"></a>01278          mu, vkmpersec;
<a name="l01279"></a>01279      <span class="keywordtype">int</span> ktr;
<a name="l01280"></a>01280 
<a name="l01281"></a>01281      <span class="comment">/* ------------------ set mathematical constants --------------- */</span>
<a name="l01282"></a>01282      <span class="comment">// sgp4fix divisor for divide by zero check on inclination</span>
<a name="l01283"></a>01283      <span class="comment">// the old check used 1.0 + cos(pi-1.0e-9), but then compared it to</span>
<a name="l01284"></a>01284      <span class="comment">// 1.5 e-12, so the threshold was changed to 1.5e-12 for consistency</span>
<a name="l01285"></a>01285      <span class="keyword">const</span> <span class="keywordtype">double</span> temp4 =   1.5e-12;
<a name="l01286"></a>01286      twopi = 2.0 * <a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>;
<a name="l01287"></a>01287      x2o3  = 2.0 / 3.0;
<a name="l01288"></a>01288      <span class="comment">// sgp4fix identify constants and allow alternate values</span>
<a name="l01289"></a>01289      <a class="code" href="gravconsttype_8cpp.html#ad4600d22fe78cc71f195a7c50ed92f3b" title="Esta función se utiliza para obtener el conjunto de valores dependiendo de la constante...">getgravconst</a>( whichconst, tumin, mu, radiusearthkm, xke, j2, j3, j4, j3oj2 );
<a name="l01290"></a>01290      vkmpersec     = radiusearthkm * xke/60.0;
<a name="l01291"></a>01291 
<a name="l01292"></a>01292      <span class="comment">/* --------------------- clear sgp4 error flag ----------------- */</span>
<a name="l01293"></a>01293      satrec-&gt;setT(tsince);
<a name="l01294"></a>01294      satrec-&gt;setError(0);
<a name="l01295"></a>01295 
<a name="l01296"></a>01296      <span class="comment">/* ------- update for secular gravity and atmospheric drag ----- */</span>
<a name="l01297"></a>01297      xmdf    = satrec-&gt;getMo() + satrec-&gt;getMdot() * satrec-&gt;getT();
<a name="l01298"></a>01298      argpdf  = satrec-&gt;getArgpo() + satrec-&gt;getArgpdot() * satrec-&gt;getT();
<a name="l01299"></a>01299      nodedf  = satrec-&gt;getNodeo() + satrec-&gt;getNodedot() * satrec-&gt;getT();
<a name="l01300"></a>01300      argpm   = argpdf;
<a name="l01301"></a>01301      mm      = xmdf;
<a name="l01302"></a>01302      t2      = satrec-&gt;getT() * satrec-&gt;getT();
<a name="l01303"></a>01303      nodem   = nodedf + satrec-&gt;getNodecf() * t2;
<a name="l01304"></a>01304      tempa   = 1.0 - satrec-&gt;getCc1() * satrec-&gt;getT();
<a name="l01305"></a>01305      tempe   = satrec-&gt;getBstar() * satrec-&gt;getCc4() * satrec-&gt;getT();
<a name="l01306"></a>01306      templ   = satrec-&gt;getT2cof() * t2;
<a name="l01307"></a>01307 
<a name="l01308"></a>01308      <span class="keywordflow">if</span> (satrec-&gt;getIsimp() != 1)
<a name="l01309"></a>01309        {
<a name="l01310"></a>01310          delomg = satrec-&gt;getOmgcof() * satrec-&gt;getT();
<a name="l01311"></a>01311          delm   = satrec-&gt;getXmcof() *
<a name="l01312"></a>01312                   (pow((1.0 + satrec-&gt;getEta() * cos(xmdf)), 3) -
<a name="l01313"></a>01313                   satrec-&gt;getDelmo());
<a name="l01314"></a>01314          temp   = delomg + delm;
<a name="l01315"></a>01315          mm     = xmdf + temp;
<a name="l01316"></a>01316          argpm  = argpdf - temp;
<a name="l01317"></a>01317          t3     = t2 * satrec-&gt;getT();
<a name="l01318"></a>01318          t4     = t3 * satrec-&gt;getT();
<a name="l01319"></a>01319          tempa  = tempa - satrec-&gt;getD2() * t2 - satrec-&gt;getD3() * t3 -
<a name="l01320"></a>01320                           satrec-&gt;getD4() * t4;
<a name="l01321"></a>01321          tempe  = tempe + satrec-&gt;getBstar() * satrec-&gt;getCc5() * (sin(mm) -
<a name="l01322"></a>01322                           satrec-&gt;getSinmao());
<a name="l01323"></a>01323          templ  = templ + satrec-&gt;getT3cof() * t3 + t4 * (satrec-&gt;getT4cof() +
<a name="l01324"></a>01324                           satrec-&gt;getT() * satrec-&gt;getT5cof());
<a name="l01325"></a>01325        }
<a name="l01326"></a>01326 
<a name="l01327"></a>01327      nm    = satrec-&gt;getNo();
<a name="l01328"></a>01328      em    = satrec-&gt;getEcco();
<a name="l01329"></a>01329      inclm = satrec-&gt;getInclo();
<a name="l01330"></a>01330      <span class="keywordflow">if</span> (satrec-&gt;getMethod() == <span class="charliteral">&#39;d&#39;</span>)
<a name="l01331"></a>01331        {
<a name="l01332"></a>01332          tc = satrec-&gt;getT();
<a name="l01333"></a>01333          dspace
<a name="l01334"></a>01334              (
<a name="l01335"></a>01335                tc,
<a name="l01336"></a>01336                em, argpm, inclm, mm,
<a name="l01337"></a>01337                nodem, dndt, nm
<a name="l01338"></a>01338              );
<a name="l01339"></a>01339        } <span class="comment">// if method = d</span>
<a name="l01340"></a>01340 
<a name="l01341"></a>01341      <span class="keywordflow">if</span> (nm &lt;= 0.0)
<a name="l01342"></a>01342        {
<a name="l01343"></a>01343 <span class="comment">//         printf(&quot;# error nm %f\n&quot;, nm);</span>
<a name="l01344"></a>01344          satrec-&gt;setError(2);
<a name="l01345"></a>01345          <span class="comment">// sgp4fix add return</span>
<a name="l01346"></a>01346          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l01347"></a>01347        }
<a name="l01348"></a>01348      am = pow((xke / nm),x2o3) * tempa * tempa;
<a name="l01349"></a>01349      nm = xke / pow(am, 1.5);
<a name="l01350"></a>01350      em = em - tempe;
<a name="l01351"></a>01351 
<a name="l01352"></a>01352      <span class="comment">// fix tolerance for error recognition</span>
<a name="l01353"></a>01353      <span class="comment">// sgp4fix am is fixed from the previous nm check</span>
<a name="l01354"></a>01354      <span class="keywordflow">if</span> ((em &gt;= 1.0) || (em &lt; -0.001)<span class="comment">/* || (am &lt; 0.95)*/</span> )
<a name="l01355"></a>01355        {
<a name="l01356"></a>01356 <span class="comment">//         printf(&quot;# error em %f\n&quot;, em);</span>
<a name="l01357"></a>01357          satrec-&gt;setError(1);
<a name="l01358"></a>01358          <span class="comment">// sgp4fix to return if there is an error in eccentricity</span>
<a name="l01359"></a>01359          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l01360"></a>01360        }
<a name="l01361"></a>01361      <span class="comment">// sgp4fix fix tolerance to avoid a divide by zero</span>
<a name="l01362"></a>01362      <span class="keywordflow">if</span> (em &lt; 1.0e-6)
<a name="l01363"></a>01363          em  = 1.0e-6;
<a name="l01364"></a>01364      mm     = mm + satrec-&gt;getNo() * templ;
<a name="l01365"></a>01365      xlm    = mm + argpm + nodem;
<a name="l01366"></a>01366      emsq   = em * em;
<a name="l01367"></a>01367      temp   = 1.0 - emsq;
<a name="l01368"></a>01368 
<a name="l01369"></a>01369      nodem  = fmod(nodem, twopi);
<a name="l01370"></a>01370      argpm  = fmod(argpm, twopi);
<a name="l01371"></a>01371      xlm    = fmod(xlm, twopi);
<a name="l01372"></a>01372      mm     = fmod(xlm - argpm - nodem, twopi);
<a name="l01373"></a>01373 
<a name="l01374"></a>01374      <span class="comment">/* ----------------- compute extra mean quantities ------------- */</span>
<a name="l01375"></a>01375      sinim = sin(inclm);
<a name="l01376"></a>01376      cosim = cos(inclm);
<a name="l01377"></a>01377 
<a name="l01378"></a>01378      <span class="comment">/* -------------------- add lunar-solar periodics -------------- */</span>
<a name="l01379"></a>01379      ep     = em;
<a name="l01380"></a>01380      xincp  = inclm;
<a name="l01381"></a>01381      argpp  = argpm;
<a name="l01382"></a>01382      nodep  = nodem;
<a name="l01383"></a>01383      mp     = mm;
<a name="l01384"></a>01384      sinip  = sinim;
<a name="l01385"></a>01385      cosip  = cosim;
<a name="l01386"></a>01386      <span class="keywordflow">if</span> (satrec-&gt;getMethod() == <span class="charliteral">&#39;d&#39;</span>)
<a name="l01387"></a>01387        {
<a name="l01388"></a>01388          dpper
<a name="l01389"></a>01389              (
<a name="l01390"></a>01390                satrec-&gt;getInclo(),
<a name="l01391"></a>01391                <span class="charliteral">&#39;n&#39;</span>, ep, xincp, nodep, argpp, mp
<a name="l01392"></a>01392              );
<a name="l01393"></a>01393          <span class="keywordflow">if</span> (xincp &lt; 0.0)
<a name="l01394"></a>01394            {
<a name="l01395"></a>01395              xincp  = -xincp;
<a name="l01396"></a>01396              nodep = nodep + <a class="code" href="sgp4__math_8h.html#a1daf785e3f68d293c7caa1c756d5cb74">pi</a>;
<a name="l01397"></a>01397              argpp  = argpp - pi;
<a name="l01398"></a>01398            }
<a name="l01399"></a>01399          <span class="keywordflow">if</span> ((ep &lt; 0.0 ) || ( ep &gt; 1.0))
<a name="l01400"></a>01400            {
<a name="l01401"></a>01401 <span class="comment">//            printf(&quot;# error ep %f\n&quot;, ep);</span>
<a name="l01402"></a>01402              satrec-&gt;setError(3);
<a name="l01403"></a>01403              <span class="comment">// sgp4fix add return</span>
<a name="l01404"></a>01404              <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l01405"></a>01405            }
<a name="l01406"></a>01406        } <span class="comment">// if method = d</span>
<a name="l01407"></a>01407 
<a name="l01408"></a>01408      <span class="comment">/* -------------------- long period periodics ------------------ */</span>
<a name="l01409"></a>01409      <span class="keywordflow">if</span> (satrec-&gt;getMethod() == <span class="charliteral">&#39;d&#39;</span>)
<a name="l01410"></a>01410        {
<a name="l01411"></a>01411          sinip =  sin(xincp);
<a name="l01412"></a>01412          cosip =  cos(xincp);
<a name="l01413"></a>01413          satrec-&gt;setAycof(-0.5*j3oj2*sinip);
<a name="l01414"></a>01414          <span class="comment">// sgp4fix for divide by zero for xincp = 180 deg</span>
<a name="l01415"></a>01415          <span class="keywordflow">if</span> (fabs(cosip+1.0) &gt; 1.5e-12)
<a name="l01416"></a>01416              satrec-&gt;setXlcof(-0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip) / (1.0 + cosip));
<a name="l01417"></a>01417            <span class="keywordflow">else</span>
<a name="l01418"></a>01418              satrec-&gt;setXlcof(  -0.25 * j3oj2 * sinip * (3.0 + 5.0 * cosip) / temp4);
<a name="l01419"></a>01419        }
<a name="l01420"></a>01420      axnl = ep * cos(argpp);
<a name="l01421"></a>01421      temp = 1.0 / (am * (1.0 - ep * ep));
<a name="l01422"></a>01422      aynl = ep* sin(argpp) + temp * satrec-&gt;getAycof();
<a name="l01423"></a>01423      xl   = mp + argpp + nodep + temp * satrec-&gt;getXlcof() * axnl;
<a name="l01424"></a>01424 
<a name="l01425"></a>01425      <span class="comment">/* --------------------- solve kepler&#39;s equation --------------- */</span>
<a name="l01426"></a>01426      u    = fmod(xl - nodep, twopi);
<a name="l01427"></a>01427      eo1  = u;
<a name="l01428"></a>01428      tem5 = 9999.9;
<a name="l01429"></a>01429      ktr = 1;
<a name="l01430"></a>01430      <span class="comment">//   sgp4fix for kepler iteration</span>
<a name="l01431"></a>01431      <span class="comment">//   the following iteration needs better limits on corrections</span>
<a name="l01432"></a>01432      <span class="keywordflow">while</span> (( fabs(tem5) &gt;= 1.0e-12) &amp;&amp; (ktr &lt;= 10) )
<a name="l01433"></a>01433        {
<a name="l01434"></a>01434          sineo1 = sin(eo1);
<a name="l01435"></a>01435          coseo1 = cos(eo1);
<a name="l01436"></a>01436          tem5   = 1.0 - coseo1 * axnl - sineo1 * aynl;
<a name="l01437"></a>01437          tem5   = (u - aynl * coseo1 + axnl * sineo1 - eo1) / tem5;
<a name="l01438"></a>01438          <span class="keywordflow">if</span>(fabs(tem5) &gt;= 0.95)
<a name="l01439"></a>01439              tem5 = tem5 &gt; 0.0 ? 0.95 : -0.95;
<a name="l01440"></a>01440          eo1    = eo1 + tem5;
<a name="l01441"></a>01441          ktr = ktr + 1;
<a name="l01442"></a>01442        }
<a name="l01443"></a>01443 
<a name="l01444"></a>01444      <span class="comment">/* ------------- short period preliminary quantities ----------- */</span>
<a name="l01445"></a>01445      ecose = axnl*coseo1 + aynl*sineo1;
<a name="l01446"></a>01446      esine = axnl*sineo1 - aynl*coseo1;
<a name="l01447"></a>01447      el2   = axnl*axnl + aynl*aynl;
<a name="l01448"></a>01448      pl    = am*(1.0-el2);
<a name="l01449"></a>01449      <span class="keywordflow">if</span> (pl &lt; 0.0)
<a name="l01450"></a>01450        {
<a name="l01451"></a>01451 <span class="comment">//         printf(&quot;# error pl %f\n&quot;, pl);</span>
<a name="l01452"></a>01452          satrec-&gt;setError(4);
<a name="l01453"></a>01453          <span class="comment">// sgp4fix add return</span>
<a name="l01454"></a>01454          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l01455"></a>01455        }
<a name="l01456"></a>01456        <span class="keywordflow">else</span>
<a name="l01457"></a>01457        {
<a name="l01458"></a>01458          rl     = am * (1.0 - ecose);
<a name="l01459"></a>01459          rdotl  = sqrt(am) * esine/rl;
<a name="l01460"></a>01460          rvdotl = sqrt(pl) / rl;
<a name="l01461"></a>01461          betal  = sqrt(1.0 - el2);
<a name="l01462"></a>01462          temp   = esine / (1.0 + betal);
<a name="l01463"></a>01463          sinu   = am / rl * (sineo1 - aynl - axnl * temp);
<a name="l01464"></a>01464          cosu   = am / rl * (coseo1 - axnl + aynl * temp);
<a name="l01465"></a>01465          su     = atan2(sinu, cosu);
<a name="l01466"></a>01466          sin2u  = (cosu + cosu) * sinu;
<a name="l01467"></a>01467          cos2u  = 1.0 - 2.0 * sinu * sinu;
<a name="l01468"></a>01468          temp   = 1.0 / pl;
<a name="l01469"></a>01469          temp1  = 0.5 * j2 * temp;
<a name="l01470"></a>01470          temp2  = temp1 * temp;
<a name="l01471"></a>01471 
<a name="l01472"></a>01472          <span class="comment">/* -------------- update for short period periodics ------------ */</span>
<a name="l01473"></a>01473          <span class="keywordflow">if</span> (satrec-&gt;getMethod() == <span class="charliteral">&#39;d&#39;</span>)
<a name="l01474"></a>01474            {
<a name="l01475"></a>01475              cosisq                 = cosip * cosip;
<a name="l01476"></a>01476              satrec-&gt;setCon41(3.0*cosisq - 1.0);
<a name="l01477"></a>01477              satrec-&gt;setX1mth2(1.0 - cosisq);
<a name="l01478"></a>01478              satrec-&gt;setX7thm1(7.0*cosisq - 1.0);
<a name="l01479"></a>01479            }
<a name="l01480"></a>01480          mrt   = rl * (1.0 - 1.5 * temp2 * betal * satrec-&gt;getCon41()) +
<a name="l01481"></a>01481                  0.5 * temp1 * satrec-&gt;getX1mth2() * cos2u;
<a name="l01482"></a>01482          su    = su - 0.25 * temp2 * satrec-&gt;getX7thm1() * sin2u;
<a name="l01483"></a>01483          xnode = nodep + 1.5 * temp2 * cosip * sin2u;
<a name="l01484"></a>01484          xinc  = xincp + 1.5 * temp2 * cosip * sinip * cos2u;
<a name="l01485"></a>01485          mvt   = rdotl - nm * temp1 * satrec-&gt;getX1mth2() * sin2u / xke;
<a name="l01486"></a>01486          rvdot = rvdotl + nm * temp1 * (satrec-&gt;getX1mth2() * cos2u +
<a name="l01487"></a>01487                  1.5 * satrec-&gt;getCon41()) / xke;
<a name="l01488"></a>01488 
<a name="l01489"></a>01489          <span class="comment">/* --------------------- orientation vectors ------------------- */</span>
<a name="l01490"></a>01490          sinsu =  sin(su);
<a name="l01491"></a>01491          cossu =  cos(su);
<a name="l01492"></a>01492          snod  =  sin(xnode);
<a name="l01493"></a>01493          cnod  =  cos(xnode);
<a name="l01494"></a>01494          sini  =  sin(xinc);
<a name="l01495"></a>01495          cosi  =  cos(xinc);
<a name="l01496"></a>01496          xmx   = -snod * cosi;
<a name="l01497"></a>01497          xmy   =  cnod * cosi;
<a name="l01498"></a>01498          ux    =  xmx * sinsu + cnod * cossu;
<a name="l01499"></a>01499          uy    =  xmy * sinsu + snod * cossu;
<a name="l01500"></a>01500          uz    =  sini * sinsu;
<a name="l01501"></a>01501          vx    =  xmx * cossu - cnod * sinsu;
<a name="l01502"></a>01502          vy    =  xmy * cossu - snod * sinsu;
<a name="l01503"></a>01503          vz    =  sini * cossu;
<a name="l01504"></a>01504 
<a name="l01505"></a>01505          <span class="comment">/* --------- position and velocity (in km and km/sec) ---------- */</span>
<a name="l01506"></a>01506          r[0] = (mrt * ux)* radiusearthkm;
<a name="l01507"></a>01507          r[1] = (mrt * uy)* radiusearthkm;
<a name="l01508"></a>01508          r[2] = (mrt * uz)* radiusearthkm;
<a name="l01509"></a>01509          v[0] = (mvt * ux + rvdot * vx) * vkmpersec;
<a name="l01510"></a>01510          v[1] = (mvt * uy + rvdot * vy) * vkmpersec;
<a name="l01511"></a>01511          v[2] = (mvt * uz + rvdot * vz) * vkmpersec;
<a name="l01512"></a>01512        }  <span class="comment">// if pl &gt; 0</span>
<a name="l01513"></a>01513 
<a name="l01514"></a>01514      <span class="comment">// sgp4fix for decaying satellites</span>
<a name="l01515"></a>01515      <span class="keywordflow">if</span> (mrt &lt; 1.0)
<a name="l01516"></a>01516        {
<a name="l01517"></a>01517 <span class="comment">//         printf(&quot;# decay condition %11.6f \n&quot;,mrt);</span>
<a name="l01518"></a>01518          satrec-&gt;setError(6);
<a name="l01519"></a>01519          <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l01520"></a>01520        }
<a name="l01521"></a>01521 
<a name="l01522"></a>01522 <span class="comment">//#include &quot;debug7.cpp&quot;</span>
<a name="l01523"></a>01523      <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l01524"></a>01524 }  <span class="comment">// end sgp4</span>
<a name="l01525"></a>01525 
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generado el Tue May 22 09:43:43 2012 para sgp4oo por&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
